Memory Configuration
Memurai can be used as a pure in-memory cache or as a data store with disk persistence. Memurai's memory footprint is about 20 MB before any data is loaded in memory.
In Memory Cache
The maxmemory
configuration flag is used to set the maximum amount of memory that Memurai can use for storing data. It works in conjunction with the key eviction policies.
Memurai supports all the Redis®️* 7 (and Valkey 7) API eviction policies, as documented here.
Data Persistence
Memurai can persist data to disk synchronously or asynchronously. To persist data asynchronously, Memurai uses a Unix-like fork mechanism to create a snapshot of the data set and save it to disk while continuing to respond to client commands. If the data set is changed while the asynchronous background save is in progress, Memurai will allocate extra memory in order to store the additional changes while preserving the data in the snapshot.
The amount of memory required in this situation can increase significantly depending on how much data is added/changed in the data set while the snapshot is being saved to disk. If the system reaches a point where it needs to swap memory, that may slow down the server. If the system runs out of memory, the asynchronous background save may fail. A failure in the background save may be temporary and not compromise the integrity of the data set, but in general a memory allocation failure is a fatal error that will cause Memurai to stop running.
The memory optimization strategies that apply to Redis 7 (and Valkey 7) also apply to Memurai.