Performance considerations
- Last Updated: July 30, 2025
- 3 minute read
- DataDirect Connectors
- ODBC
- MongoDB 8.0
- Documentation
Enable DNS Lookup
(EnableDNSLookup): Enable DNS Lookup specifies whether the driver performs a DNS
lookup to discover member nodes of a cluster when attempting to connect. If you are
connecting to a non-clustered environment, you can bypass the lookup and improve
connection time by disabling this option (EnableDNSLookup=0).
Encryption Method (EncryptionMethod): Data encryption may adversely affect performance because of the additional overhead (mainly CPU usage) that is required to encrypt and decrypt data.
Fetch Size (FetchSize): Reducing the number of round trips on the network to the approximate number of rows being fetched increases performance. For example, if your application normally fetches 200 rows, it is more efficient for the driver to fetch 200 rows at one time over the network than to fetch 50 rows at a time during four round trips over the network.
JVM Arguments (JVMArgs): This connection option can be used to address memory and performance concerns by adjusting the max Java heap size. By increasing the max Java heap size, you increase the amount of data the driver accumulates in memory. This can reduce the likelihood of out-of-memory errors and improve performance by ensuring that result sets fit easily within the JVM's free heap space.
Read Preference (ReadPreference): This connection option allows you to specify your preference for which replica set members are read when executing queries. Executing queries against primary members (read-write server nodes) returns the most recent version of the data, but increases the workload of the primary members and may negatively affect performance. If your application does not require the most recent version of data, consider setting this connection option to read from secondary members (read-only server nodes) to improve performance.
Result Memory Size (ResultMemorySize): Since Result Memory Size specifies the maximum size of an intermediate result set that the driver holds in memory, it can affect performance in two ways. First, if the value of the result set is larger than the value specified for Result Memory Size, the driver writes a portion of the result set to disk. Since writing to disk is an expensive operation, performance losses will be incurred. Second, when you remove any limit on the size of an intermediate result set by setting Result Memory Size to 0, you can realize performance gains for result sets that easily fit within the JVM's free heap space. However, the same setting can diminish performance for result sets that only just fit within the JVM's free heap space.
Schema Filter (SchemaFilter): Schema Filter provides a method to limit the database and collection pairs for which the driver fetches metadata. If your application only needs to access a subset of the collections you have access to, you can significantly improve connection times by providing a value for this option.