Detail
Aerospike provides the ability to expire a record by setting its TTL (Time To Live) from a client. The TTL value is the number of seconds that a record will live (from the current time) before being removed by the server. What gets stored, though, is the void time (which is an absolute time computed in citrusleaf epoch -- number of seconds since January 1st 2010 at 00:00:00 UTC). The expiration and eviction algorithms use the record's TTL to determine eligibility for removal. The TTL value can be changed by a client with a simple record update. Changing the value can either accelerate, delay or prevent expiration or eviction of a record.
Record Expiration values (TTL)
| TTL (Client) | TTL (Server) | Description |
|---|---|---|
| -2 | same | Do not change ttl when record is updated. |
| -1 | 0 | Never expire. |
| 0 | def. | Default to namespace configuration variable "default-ttl" on the server. |
| >0 | >0 | Actual ttl in seconds (some client support the following time units S, M, H, D) |
Answer
The TTL histogram is used in the server expiration algorithm to expire records at the specified TTL value. The histogram is based on the tracked max void time. This max value is used to determine the bucket width of the TTL and eviction histograms.
The max void time value can be influenced by one of these actions:
- The TTL value of a record is increased.
- The namespace storage is persistent to disk and the server is cold restarted.
- The Server is fast restarted.
Resetting the TTL of an existing record to "never expire" by updating the TTL to -1, or setting it to a lower TTL value from a client does not trigger the bucket width of the TTL histogram to get re-calculated. The Max Void time will remain the same until one of the following has occurred:
-
Server is fast restarted. The max void time will be adjusted to the next highest TTL.
-
A record with a Higher TTL is inserted or updated. The max void time will adjust to the higher TTL.
Notes
In certain cases where bucket widths and evictions precision is important and using persisteny storage, one should be aware of the behavior of changing a record's TTL (to never expire or to a lower value then originally set).
The record will not be eligible for evictions or expirations after its TTL has been set to "Never Expire" (-1 from an Aerospike Client, or 0 from default-ttl)
The TTL histogram width will not change since the max void time would remain the same. This particular scenario can impact the eviction precision as more records may fall on same buckets.