Hazelcast entry expiry delay

Viewed 132

I have entry expired listener registered on a IMap. I insert ~1 000 000 records into the map with ttl of 10 minutes.

Data is inserted over the range of 5 minutes:

10:00 - 10:05 -> all records are inserted

I expect first record to expire at 10:00 + 10 minutes ttl = 10:10

I expect last record to expire at 10:05 + 10 minutes ttl = 10:15

First record expires roughly at the proper time (~30 seconds more or less), but last record expires 10:25 which is way later than expected. I ran more similar tests, results are the same.

For this test entry expired listener code just counts expired records and logs each 500th record. I tried using more threads to make sure there is no issue with throughput, behavior was completely the same.

I found this answer: HazelCast - Expiration listener delay

Is this behavior expected from entry expired listener? Small delay would be acceptable.

Also, suggestions to do this differently are welcome. I am using cache as a buffer and need to process entries on buffer expiry. Buffer would hold a maximum of ~4 000 000 records at a time.

Hazelcast version 4.2.1 | Java version 1.8.0_301

Running in client-server architecture

0 Answers
Related