ResultMemorySize
- Last Updated: June 12, 2020
- 2 minute read
- DataDirect Connectors
- JDBC
- MongoDB 6.0
- Documentation
Purpose
Specifies the maximum size, in megabytes, of an intermediate result set that the driver holds in memory. When this threshold is reached, the driver writes a portion of the result set to disk in temporary files.
Valid Values
-1 | 0 | x
where:
- x
- is the maximum size, in MB, of an intermediate result set that the driver holds in memory.
Behavior
If set to -1, the maximum size of an
intermediate result that the driver holds in memory is a percentage of the max Java
heap size. When this threshold is reached, the driver writes a portion of the result
set to disk.
If set to 0, the driver holds the entire
intermediate result set in memory regardless of size. No portion of the result set
is written to disk. Setting ResultMemorySize to 0 can improve
performance for result sets that easily fit within the JVM's free heap space, but
can diminish performance for result sets that barely fit within the JVM's free heap
space.
If set to x, the driver holds intermediate results in memory that are no larger than the size specified. When this threshold is reached, the driver writes a portion of the result set to disk.
Notes
- By default, ResultMemorySize is set to
-1. When set to-1, the maximum size of an intermediate result that the driver holds in memory is a percentage of the max Java heap size. When processing large sets of data, out-of-memory errors can occur when the size of the result set exceeds the available memory allocated to the JVM. In this scenario, you can tune ResultMemorySize to suit your environment. To begin, set ResultMemorySize equal to the max Java heap size divided by 4. Proceed by decreasing this value until out-of-memory errors are eliminated. As a result, the maximum size of an intermediate result set the driver holds in memory will be reduced, and some portion of the result set will be written to disk. Be aware that while writing to disk reduces the risk of out-of-memory errors, it also negatively impacts performance. For optimal performance, decrease this value only to a size necessary to avoid errors. - You can also adjust the max Java heap size 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, increasing the max Java heap size can improve performance by reducing the need to write to disk, or removing it altogether. - The FetchSize connection property can also be used to reduce demands on memory and decrease the likelihood of out-of-memory errors.
Default
-1
Data Type
Int
See also
- Using Connection Properties
- Performance Considerations
- FetchSize
-
Refer to the Troubleshooting section in the Progress DataDirect for JDBC Drivers Reference for details.