Forcing eviction at TTL for a single map

451 views
Skip to first unread message

Nidhi Aggarwal

unread,
Mar 7, 2018, 3:51:10 PM3/7/18
to Hazelcast
Hi All,

I came across a problem where Hazelcast's map is evicting entries at a significant delay from configured TTL. Found a solution to set the following properties to force eviction at TTL here: https://github.com/hazelcast/hazelcast/issues/8894. The properties can be reset as:

Config config = new Config();
config.setProperty("hazelcast.internal.map.expiration.task.period.seconds", "1");
config.setProperty("hazelcast.internal.map.expiration.cleanup.percentage", "100");
config.setProperty("hazelcast.internal.map.expiration.cleanup.operation.count", "271");

The problem now is that these properties apply to the entire instance. Are you aware if this can be set for a single map in the instance?

Thanks,
Nidhi



Ahmet Mircik

unread,
Mar 8, 2018, 2:29:37 AM3/8/18
to Hazelcast

Hi Nidhi,

First some hazelcast parlance, we call it expiration if an entry removal reason is TTL. Otherwise when an entry is removed to release memory for subsequent puts it is called eviction.

Secondly, expired entries are removed by calling get on them or by the help of background sweeper task. The properties you used are for this background task. This task slowly scans some portion of all maps and removes expired entries. Since these entries are already expired and unreachable, there is no difference whether you set them per-map.

Can you please elaborate on what exactly you try to achieve and why are looking for a per-map setting?



--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+unsubscribe@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/b467c8de-0d7f-4cc8-9a49-dbf951bd2827%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nidhi Aggarwal

unread,
Mar 8, 2018, 9:43:38 AM3/8/18
to Hazelcast
Hi Ahmet,

Thanks for the clarification. I discovered there is an EntryExpiredListener as well in addition to EntryEvictedListener but the behavior of both was the same for entryEvicted() and entryExpired(). 

I have some logic which must be called when an entry expires after TTLs without much delay and thus trying to find a way to do that.

Since setting these properties might have a performance hit, I wanted to check if there is a per-map setting.


On Thursday, March 8, 2018 at 2:29:37 AM UTC-5, Ahmet Mircik wrote:

Hi Nidhi,

First some hazelcast parlance, we call it expiration if an entry removal reason is TTL. Otherwise when an entry is removed to release memory for subsequent puts it is called eviction.

Secondly, expired entries are removed by calling get on them or by the help of background sweeper task. The properties you used are for this background task. This task slowly scans some portion of all maps and removes expired entries. Since these entries are already expired and unreachable, there is no difference whether you set them per-map.

Can you please elaborate on what exactly you try to achieve and why are looking for a per-map setting?


On Wed, Mar 7, 2018 at 11:51 PM, Nidhi Aggarwal <nidhi.ashwa...@gmail.com> wrote:
Hi All,

I came across a problem where Hazelcast's map is evicting entries at a significant delay from configured TTL. Found a solution to set the following properties to force eviction at TTL here: https://github.com/hazelcast/hazelcast/issues/8894. The properties can be reset as:

Config config = new Config();
config.setProperty("hazelcast.internal.map.expiration.task.period.seconds", "1");
config.setProperty("hazelcast.internal.map.expiration.cleanup.percentage", "100");
config.setProperty("hazelcast.internal.map.expiration.cleanup.operation.count", "271");

The problem now is that these properties apply to the entire instance. Are you aware if this can be set for a single map in the instance?

Thanks,
Nidhi



--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.

Ahmet Mircik

unread,
Mar 8, 2018, 12:16:07 PM3/8/18
to Hazelcast

Regarding listeners, EntryExpiredListener can only listen expirations while EntryEvictedListener can listen both expirations and evictions due to the compatibility reasons.

For performance effect, you need to measure/tune it yourself, but worth to know that the task only scans maps which has expiration configured. Even we have a per-map option, it can still be possible to affect other operations, expirations are done by the same shared operation threads that other data structures use.


To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+unsubscribe@googlegroups.com.

To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
Reply all
Reply to author
Forward
0 new messages