You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haze...@googlegroups.com
Hey,
I'm using hazelcast to implement a clustered Atmosphere (Websocket, Comet) Chat-Application. My application will produce a lot of different topics (each chat has a unique id where messages are published).
As I see in Hazelcast Management Console, my list of Topics grow and old Topic's (that might have no subscribers) are not deleted. I think this will yield in memory error's in the near future :).
Is there anything that will prevent this behavior; Like a Timeout if a Topic has no subscribers?
David
Peter Veentjer
unread,
Oct 19, 2012, 9:16:17 AM10/19/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haze...@googlegroups.com
AFAIK there is no garbage collection mechanism available for the topic.
So I guess the thing you can do is
1) get hold of the itopics. Perhaps store the names of the topic in
hazelcast, e.g. in a map, when the topic is created.
2) walk over the topics periodically
3) determine if a topic is unused (easier said then done). Perhaps you
can have a look at the getLocalTopicStats() and determine 'stale'
based on change in number of receives messages. If there is no change
for example 30 minutes, then the Topic could be seen as dead. See
http://www.hazelcast.com/javadoc/com/hazelcast/impl/monitor/LocalTopicOperationStatsImpl.html 4) destroy the instance when marked as dead.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haze...@googlegroups.com
Thank you, think it will be very complicated :/
"getLocalTopicStats" will only return stats for my specific Cluster i call this method on, or? So I can never be sure that other nodes may still active.
And destroy will "kill" this topic on the whole cluster.
Peter Veentjer
unread,
Oct 19, 2012, 9:59:43 AM10/19/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haze...@googlegroups.com
On Fri, Oct 19, 2012 at 4:45 PM, David Heidrich <m...@bowlingx.com> wrote:
> Thank you, think it will be very complicated :/
>
> "getLocalTopicStats" will only return stats for my specific Cluster i call
> this method on, or?
I guess so.
But that should not be the end of the world. You still can still let
each member iterate over all topics and read out the local stats. They
need to compare the previous stats with the new stats, if there is no
change. then the next topic is checked. If there is a change, you
publish some 'last updated' timestamp in a hazelcast map (so key:
topic.name, and value: last updated timestamp.
And then in another process you iterate over this map, and see which
topics have an expired timestamp.
Perhaps someone else can come up with a simpler solution.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haze...@googlegroups.com
That may be another solution:
- Create a map named 'topicEvictionMap'. That will store topics' names as keys.
- On configuration set time-to-live-seconds 6 hours for this map. (as records to be evicted in 6 hours if not updated)
- Add a messageListener for each topic. onMessage() method update topicEvictionMap. (you can set current time or any different value: topicEvictionMap.put(topicName, System.currentTimeInMillis); )
- At each hour, traverse topic names, check whether its name exists in topicEvictionMap. If it does not exist you can destroy it.
--
Enes Akar
Hazelcast | Open source in-memory data grid Mobile: +90.505.394.1668