Performance considerations
- Last Updated: October 27, 2020
- 3 minute read
- DataDirect Connectors
- ODBC
- MongoDB 8.0
- Documentation
Application Using Threads (ApplicationUsingThreads): The driver coordinates concurrent database operations (operations from different threads) by acquiring locks. Although locking prevents errors in the driver, it also decreases performance. If your application does not make ODBC calls from different threads, the driver has no reason to coordinate operations. In this case, the ApplicationUsingThreads attribute should be disabled (set to 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.
JVM Arguments (JVMArgs): Used in conjunction with the Result Memory Size connection option, you can address memory and performance concerns by adjusting the max Java heap size using the JVM Arguments connection option. 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. In addition, when a limit is imposed by setting Result Memory Size to -1 or x, increasing the max Java heap size can improve performance by reducing the need to write to disk, or removing it altogether.
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 barely fit within the JVM's free heap space.