Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find records with TTL 0 in Aerospike

Tags:

aerospike

ttl

my aerospike cluster hitting 50% disk usage and records are started evicting. I have doubt I do not write that many records daily to the cluster.Per records we have 90days TTL set and default TTL for namespace is 30days.

What my concern is, I am assuming we have records with 0 TTL which are not getting evicted and not even being used. How do I audit and find records (number of objects) with 0 TTL which should be changed immediatly to default TTL.

Thanks.

like image 883
user3369417 Avatar asked Mar 11 '23 06:03

user3369417


2 Answers

Couple of things:

Aerospike logs will tell you how many records do not have any expiration, look for the number of '0 v-t' records in the following line (in my example, here it is 0):

{ns-name} Records: 37118670, 0 0-vt, 0(377102877) expired, 185677(145304222) evicted, 0(0) set deletes, 0(0) set evicted. Evict ttls: 34560,38880,0.118. Waits: 0,0,8743. Total time: 45467 ms

This will quickly the 'proportion' of non expirable records for that namespace (since you have the total number of records right next to it).

In order to fully identify which records those are and potentially set an expiration, you would have to scan the records and update them... There is sample code in java to scan a set (or a namespace) on this repo. There may be other much more elegant solutions, though, but they would still involve writing a bit of code.

like image 52
Meher Avatar answered Mar 31 '23 19:03

Meher


You look for the following log line:

Sep 02 2016 15:14:00 GMT: INFO (nsup): (thr_nsup.c:1114) {test} Records: 3725361, 0 0-vt, 0(0) expired, 0(0) evicted, 0(0) set deletes. Evict ttl: 0. Waits: 0,0,0. Total time: 765 ms

This is the namespace supervisor reporting on a namespace called 'test' and it is saying that there are 372561 records of which there are 0 with 0-vt or void time.

TTL is the delta between the time now and the void time of the record (when it will expire) and so a record where void time is 0 is one that will never expire or be evicted.

like image 26
Ben Bates Avatar answered Mar 31 '23 19:03

Ben Bates