Monitoring Queries for Low Memory
The query monitoring feature prevents out-of-memory exceptions from occurring when you execute queries or create indexes.
This feature is automatically enabled when you set a
critical-heap-percentage attribute for the resource-manager element in cache.xml or by using the
cache.getResourceManager().setCriticalHeapPercentage(float heapPercentage) API. Use this feature to cancel out queries that are taking too long and to warn the user that there are low memory conditions when they are running queries or creating indexes.
You can override this feature by setting the system property
gemfire.cache.DISABLE_QUERY_MONITOR_FOR_LOW_MEMORY to true.
When the query memory monitoring feature is on, the default query time out is set to five hours. You can override this value by setting a larger or smaller, non -1 value to the existing query time out system variable
When system memory is low (as determined by the critical heap percentage threshold that you defined in cache.xml or in the getResourceManager API ), queries will throw a
QueryExecutionLowMemoryException. Any indexes that are in the process of being created will throw an
InvalidIndexException with the message indicating the reason.
Partitioned region queries are likely causes for out-of-memory exceptions. If query monitoring is enabled, partitioned region queries drop or ignore results that are being gathered by other servers if the executing server is low in memory.
Query-monitoring does not address a scenario in which a low-level collection is expanded while the partitioned region query is gathering results. For example, if a row is added and then causes a Java level collection or array to expand, it is possible to then encounter an out-of-memory exception. This scenario is rare and is only possible if the collection size itself expands before a low memory condition is met and then expands beyond the remaining available memory. As a workaround, in the event that you encounter this situation, you may be able to tune the system by additionally lowering the