Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Lease expire notification

I have a few listeners (and notify containers) and I noticed that I have a delay receiving the notifications compared to the lease I set. Then I found this: http://www.gigaspaces.com/wiki/displa... and understood the mechanism. One of my question is how much overload is added by reducing that period to 1 second or even lower?

One other thing. I read on that page "This involves iterating through all the expired objects". From this I understand that the expired objects are already known and this thread is not responsible to iterate trough all objects and determine which objects are expired. Am I right? In this case it should be possible to receive notifications right when they are expired with no need for this tread to notify the listeners. Is there such a mechanism to notify the lease expire listeners in a more "real time" way, not using a thread that runs every x seconds?

And a final question. Are there any other things in gigaspace that can be used like a timer? To generate some events at a specified time or delay except of lease expire event?

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2912]{quote}

asked 2009-02-27 04:50:30 -0500

lukeh gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Hello Lucian,

You can decrease the lease expiration timeout to1 sec. This may or may not be considered a significant load based on other load on your sever. You should test and see.
The lease expiration mechanism is not intended as a timer mechanism. If you need a timer, use java.util.Timer or other alternative instead.

Guy

answered 2009-02-27 08:07:10 -0500

nirpaz gravatar image
edit flag offensive delete link more

Comments

Thanks for the answer, My scenario (simplified) is like this: I have some objects that i put in the space with a field quantity. This quantity is (partialy) consumed when other similar objects are written in space. Also they have a lifetime during which I can consume the quantity. After the lifetime expires I want to report the remaining quantity by writing another object in the space. For this I model the lifetime using the lease. I wished to listen for lease expire to write the final report object. This is why I need something like a "timer". But I found that with the default settings that report is generated with ~15 seconds delay. Would you suggest in this case to keep some data in memory in the PU and use a java.util.Timer for it? It looked like such a clean approach to use the lease expire for it.

lukeh gravatar imagelukeh ( 2009-02-27 09:28:40 -0500 )edit

Hi,

If you can live with a resolution time of +-1 sec, you can reduce the lease expiration duration for 1sec and register for lease expiration events.

Bear in mind that lease expiration events are a result of either: 1. lease expiration thread that is invoked once every lease-expiration timeout 2. During normal space operation (read/update) if the operation thread 'finds' an expired entry it is reported and notified as well.

Guy

nirpaz gravatar imagenirpaz ( 2009-02-27 09:57:36 -0500 )edit

One more impotent note: Notifications for expired entries sent both from the primary and the backup space (in case you have such).

Shay

shay hassidim gravatar imageshay hassidim ( 2009-02-27 15:57:16 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2009-02-27 04:50:30 -0500

Seen: 175 times

Last updated: Feb 27 '09