How Atoti divides data, indexes, and aggregate providers between heap and off-heap memory, why memory usage stays high after deletion without being a leak, and how the allocator cache, index rebuilds, and cube schema rebuilds reclaim it.
Atoti keeps its data, and the structures that speed up queries, in both heap and off-heap memory.
Knowing which structure lives where explains why memory usage can stay high after data is deleted.
This page builds on How JVM tuning can improve Atoti performance, which introduces the two memory areas.
Which structures use heap memory and which use off-heap memory?
By default, Atoti stores most data and indexes off-heap, and keeps object values and temporary query objects on the heap.
Off-heap memory: Numeric values, datastore indexes, references, and the pre-aggregated data of aggregate providers.
Heap memory: Object values such as text and dates, bitmap indexes, and the temporary objects that queries create.
A debugging-only JVM setting can keep all stored data on the heap.
It applies to both the Atoti Java SDK and the Atoti Python SDK.
Which structures take the most memory?
Datastore indexes: A datastore index finds the records that match given field values, without scanning the whole store. Each index grows with the number of records. See How to index stores with Atoti Java SDK.
References: A reference links the records of one store to the matching records of another store. Each reference also grows with the number of records. See What is a database schema?
Bitmap indexes: A bitmap aggregate provider uses a bitmap index to find the cells that match each hierarchy member. Each bitmap index grows with the number of hierarchies and with the number of members in each hierarchy. See How aggregate providers can speed query time.
How is memory impacted by data deletion?
Atoti frees the memory of deleted records once nothing uses them: It waits until no running query or retained version still uses those records. Memory is freed one chunk at a time. A chunk is freed when all its rows are deleted, and compacted when enough of its rows are deleted.
A long-running query keeps the records it reads until the query ends.
A retained version keeps its records, even after they are deleted from the latest version.
Freed memory goes into the allocator cache, up to a maximum size: The maximum size is a share of the maximum off-heap memory. Above that size, freed memory returns to the operating system.
Atoti reuses the cached memory for new data: For example, the data of the next as-of date reuses the memory of the deleted one. The cache does not need to be cleared.
Memory usage stays high, but this is not a leak: The operating system and monitoring tools still count cached memory as used by Atoti.
Indexes and other structures are append-only: Deleting records marks them as deleted, but these structures keep them:
Datastore indexes.
References.
Dictionaries, which store each distinct value of a field once.
Point indexes, which locate the pre-aggregated cells of aggregate providers.
Bitmap indexes.
Only a manually triggered rebuild removes the deleted records from datastore indexes, point indexes, and bitmap indexes.
Can memory be reclaimed?
A memory analysis report shows which stores, indexes, and aggregate providers use the most memory.
See Memory analysis report.
Read the report first to decide which of the following actions applies.
Rebuilding indexes or a cube schema takes significant processing time and memory.
While a rebuild runs, no data can be loaded into any store.
An index rebuild keeps only the latest version of the data on each branch. Older versions are permanently lost.
Run rebuilds during quiet periods, such as outside business hours.
Three actions reclaim memory:
Reduce or turn off the allocator cache (JVM setting): Freed memory then returns to the operating system, for use by other processes. Later data loads must request that memory again. See Properties in Atoti Server.
Rebuild the datastore indexes of large stores (Atoti Java SDK): The rebuilt indexes contain only the records that remain in the store. See Rebuild indexes.
Rebuild the cube schema (Atoti Java SDK): The rebuild recreates the point indexes and bitmap indexes of aggregate providers.
Rebuilds alone do not always return memory to the operating system. Combine a rebuild with turning off the allocator cache.