Performance Considerations
- Last Updated: June 12, 2020
- 2 minute read
- DataDirect Connectors
- JDBC
- MongoDB 6.0
- Documentation
EncryptionMethod: Data encryption may adversely affect performance because of the additional overhead (mainly CPU usage) required to encrypt and decrypt data.
FetchSize: FetchSize can be used to adjust the trade-off between throughput and response time. Smaller fetch sizes can improve the initial response time of the query. Larger fetch sizes can improve overall response times at the cost of additional memory.
MaxPooledStatements: To improve performance, the driver's own internal
prepared statement pooling should be enabled when the driver does not run from within an
application server or from within another application that does not provide its own prepared
statement pooling. When the driver's internal prepared statement pooling is enabled, the
driver caches a certain number of prepared statements created by an application. For example,
if the MaxPooledStatements property is set to 20, the driver
caches the last 20 prepared statements created by the application. If the value set for this
property is greater than the number of prepared statements used by the application, all
prepared statements are cached.
Refer to Designing JDBC applications for performance optimization in the Progress DataDirect for JDBC Drivers Reference for more information about using prepared statement pooling to optimize performance.
ReadPreference: ReadPreference allows you to specify your preference for which replica set members are read when executing queries. Executing queries against primary members (read-write databases) 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 property to read from secondary members (read-only databases) to improve performance.
ResultMemorySize: ResultMemorySize can affect
performance in two main ways. First, if the size of the result set is larger than the value
specified for ResultMemorySize, 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 ResultMemorySize 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.
JVM Heap Size: JVM heap size can be used to address
memory and performance concerns. 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 ResultMemorySize 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.