You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dispose of Iterators to Prevent Memory Leaks
Always dispose of iterators when you're done with them. Iterators retain references to data segments, which can lead to memory leaks if not disposed of, as the compaction process will not delete data segments until all iterators are released.
Use Atomic Methods Only When Necessary
Avoid calling atomic methods unless absolutely needed, as they are slower. Atomic methods are intended for scenarios where you need to implement counters on specific keys or perform iterative updates in a single atomic operation to avoid race conditions (read + modify + update).
Tune MutableSegmentMaxItemCount Based on Data Size
By default, MutableSegmentMaxItemCount is set to 1 million. This parameter controls the maximum record count held in the WAL and memory. Once this threshold is reached, the maintainer automatically starts the compaction process, which clears the memory segment and deletes the WAL after transferring data to disk segments.
If your keys and values are large, consider lowering this threshold to reduce memory usage.
Reduce GC Pressure with Structs and Primitive Types
To minimize garbage collection pressure, use structs and primitive types for keys and values whenever possible.
Create a Maintainer to Enable Automatic Compaction
Ensure that you create a maintainer for ZoneTree. Without a maintainer, the compaction process will not start automatically, and ZoneTree will never move data from WAL and memory to disk segments, leading to excessive memory usage.
Avoid Modifying Inserted Keys and Values
Do not modify keys or values once they are inserted into ZoneTree. Modifying them can lead to undefined behavior. Use structs instead of classes as key and value types to prevent accidental modifications.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Dispose of Iterators to Prevent Memory Leaks
Always dispose of iterators when you're done with them. Iterators retain references to data segments, which can lead to memory leaks if not disposed of, as the compaction process will not delete data segments until all iterators are released.
Use Atomic Methods Only When Necessary
Avoid calling atomic methods unless absolutely needed, as they are slower. Atomic methods are intended for scenarios where you need to implement counters on specific keys or perform iterative updates in a single atomic operation to avoid race conditions (read + modify + update).
Tune
MutableSegmentMaxItemCount
Based on Data SizeBy default, MutableSegmentMaxItemCount is set to 1 million. This parameter controls the maximum record count held in the WAL and memory. Once this threshold is reached, the maintainer automatically starts the compaction process, which clears the memory segment and deletes the WAL after transferring data to disk segments.
If your keys and values are large, consider lowering this threshold to reduce memory usage.
Reduce GC Pressure with Structs and Primitive Types
To minimize garbage collection pressure, use structs and primitive types for keys and values whenever possible.
Create a Maintainer to Enable Automatic Compaction
Ensure that you create a maintainer for ZoneTree. Without a maintainer, the compaction process will not start automatically, and ZoneTree will never move data from WAL and memory to disk segments, leading to excessive memory usage.
Avoid Modifying Inserted Keys and Values
Do not modify keys or values once they are inserted into ZoneTree. Modifying them can lead to undefined behavior. Use structs instead of classes as key and value types to prevent accidental modifications.
Beta Was this translation helpful? Give feedback.
All reactions