Duplicating objects across partitions is great for locality of reference. Duplicating enough objects leads to OutOfMemoryExceptions. We need to keep enough data in the memory to be useful, but not so much that our grid crashes after loading too many objects. The time-to-live property on BackingMap helps us avoid this problem.
The time-to-live property tells a BackingMap how long to keep an object in the memory. After that time has elapsed, the object is eligible for eviction from the BackingMap. Eviction takes place with an Evictor plug-in. Most commonly, we use the (default) time-to-live evictor, LRUEvictor, and LFUEvictor.
The LRU and LFU evictors are based on the usual suspects of least-recently used, and least-frequently used objects. We can avoid trouble with our duplicated Account objects by setting an LRUEvictor as its BackingMap evictor. We give it a time-to-live of 12 hours:
<backingMap name="Account" ttlEvictorType="CREATION_TIME" timeToLive...