How can I track the TTL of evicted data?

by young » Fri Nov 16, 2012 4:40 pm

How can I track the TTL of evicted data?

In general, an Aerospike database should be maintained by having the records expire or be manually deleted. However, as a safety feature the database will start “evicting” data when actual storage or memory use goes above some percentage of capacity. This will ensure that the database will continue to operate.

As usage goes over a high watermark, The database will automatically start deleting the oldest data. For example, if the time to live (TTL) is set at 90 days, data at 89 days will be evicted first, then 88, etc. This will continue until the amount of storage used is back under the high watermark.

It is useful to know how the default configured TTL compares to the actual time the data should have.

In order to get the configured TTL value, issue the following command on a node:

CODE: SELECT ALL $ /usr/bin/clinfo -v “namespace/[namespace]” | tr “;” “\n” | grep default-ttl

An example of the output is:

default-ttl=7776000

The response is in number of seconds. 7,776,000 seconds is 90 days. Now to find the amount of time the evicted object have lived, you can run the following command on each node:

/usr/bin/clinfo -v "statistics" | tr ";" "\n" | grep evict

The output might look like this:

stat_evicted_objects_time=6840629
stat_evicted_objects_min=6609395
stat_evicted_objects_max=6998397

Again, the output is in seconds (6840629 =~ 79 days) . Note that the first item is the average time, the min and max times are also provided.

This example shows that although the database was configured to store all records up to 90 days old, that younger ones have been evicted.