Grid Stores Overview
Grid stores are designed to achieve a minimal EMS server memory footprint and quick EMS server recovery time upon failover. When configured to use grid stores, the majority of server data is stored in an ActiveSpaces data grid and is read into memory only on-demand. A small portion of the information may be cached to speed up message processing, but the remainder is removed from memory once relevant operations are completed. This approach decouples the EMS server's memory usage and failover time from the size of its stores.
When using grid stores, persistent message data and state information are always written to the ActiveSpaces data grid. However, non-persistent data is still stored in memory in most cases. Non-persistent messages can be moved to the data grid if message swapping is enabled. When message swapping is enabled and the maximum message memory limit or the destination swap out threshold have been exceeded, non-persistent messages will be swapped from memory to the data grid. The impact of non-persistent messages on server memory can be reduced by setting a low value for max_msg_memory or destination_backlog_swapout parameters.
This storage-centered design of grid stores lends itself to quick server start-up times. As opposed to other store types, the entirety of each store's contents is not read upon server start-up or failover. Instead, the server continuously performs incremental scans of the grid stores in the background. This allows for much faster server recovery when the store sizes have grown very large.
The server scans through its grid stores incrementally in the background and discards stale data, such as purged and expired messages. As a result, purged and expired messages are not immediately removed, and may remain in a grid store longer than they would in a file-based or FTL store - although they are not delivered to consumers. The scanning behavior is determined by parameter settings in the store's configuration, and is further described in Understanding Grid Store Intervals.
A full background scan of the grid stores must be completed in order to obtain the correct overall statistics. Due to this, querying the server for a total pending message count before the grid stores have been fully scanned may return an inaccurate value. However, querying specific destinations, consumers or durables will return an accurate count. See Implications for Statistics for more information.
The latency costs in communicating with ActiveSpaces can make grid stores slower than file-based stores or FTL stores. The strength of grid stores lies with their scalability and consistent recovery time regardless of store size.