Ejection is a process automatically performed by Couchbase Server; it is the process of removing data from RAM to provide room for frequently-used items. When Couchbase Server ejects information, it works in conjunction with the disk persistence system to ensure that data in RAM has been persisted to disk and can be safely retrieved back into RAM if the item is requested. The process that Couchbase Server performs to free space in RAM, and to ensure the most-used items are still available in RAM is also known as working set management.
In addition to memory quota for the caching layer, there are two
watermarks the engine will use to determine when it is necessary
to start persisting more data to disk. These are
mem_low_wat and
mem_high_wat.
As the caching layer becomes full of data, eventually the
mem_low_wat is passed. At this time, no action is taken. As data
continues to load, it will eventually reach
mem_high_wat. At this point a background job
is scheduled to ensure items are migrated to disk and the memory
is then available for other Couchbase Server items. This job
will run until measured memory reaches
mem_low_wat. If the rate of incoming items is
faster than the migration of items to disk, the system may
return errors indicating there is not enough space. This will
continue until there is available memory. The process of
removing data from the caching to make way for the actively used
information is called ejection, and is
controlled automatically through thresholds set on each
configured bucket in your Couchbase Server Cluster.
Some of you may be using only memcached buckets with Couchbase Server; in this case the server provides only a caching layer as storage and no data persistence on disk. If your server runs out of space in RAM, it will evict items from RAM on a least recently used basis (LRU). Eviction means the server will remove the key, metadata and all other data for the item from RAM. After eviction, the item is irretrievable.
For more detailed technical information about ejection and working set management, including any administrative tasks which impact this process, see Section 5.3, “Ejection and Working Set Management”.