|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Locking mechanism in IIB 10 Global Cache |
« View previous topic :: View next topic » |
Author |
Message
|
hopsala |
Posted: Mon Jun 20, 2016 5:43 am Post subject: Locking mechanism in IIB 10 Global Cache |
|
|
 Guardian
Joined: 24 Sep 2004 Posts: 960
|
Hi guys, long time, how is everyone doing?
I've got an interesting conundrum for you. I'm trying to implement the following caching scenario: I want to load data from a file before any flow starts running (or when the first message is processed), and I want to be able to refresh my cache on-demand without requiring a restart.
If I was doing this sort of thing in Java, it would be simple enough - a singleton pattern with a synchronize lock. When messages start getting processed the first message flow runs the load() function and others wait for it to finish on synchronize. The refresh function does pretty much the same thing. I've done this in other projects and it works just fine.
Using GC however, I've got a serious problem. I haven't been able to find any mention anywhere (here, infocenter, developerworks, google..) on a synchronize/lock capability, especially considering that I need it to synchronize across EGs and even brokers. Without a lock racing conditions like the following can easily occur:
1. Broker goes up
2. Message flows MF1 on EG1 and MF2 on EG2 start processing messages simultaneously
3. MF1 and MF2 see that the cache is empty and so start loading it, thereby creating a nice little mess of duplicate data
It gets even worse when I want to do a cache refresh during runtime, because this involves deleting the current cache as well..
So my question is:
Is there some sort of lock/synchronize functionality in IIB10 Global Cache? Specifically one that works across EGs?
If not, IMHO the GC is nearly unusable for most real-world caching scenarios that I've come across (see also this link)...
Would appreciate your feedback, thanks!  |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 20, 2016 9:13 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
|
Back to top |
|
 |
hopsala |
Posted: Mon Jun 20, 2016 10:52 pm Post subject: |
|
|
 Guardian
Joined: 24 Sep 2004 Posts: 960
|
Thanks fjb! That's exactly what I needed So all locking features are included in IIB 10?
(I'm asking because I remember reading that not all Extreme Scale features are available with base IIB 10 without purchasing an additional license)
After digging in the literature quite a bit, I see that doing a refresh, like you said, would be easy - I can simply update the cache and commit it only when I'm done, so I get an atomic action.
But I still can't figure out how to do the initial load. I can't see anywhere in the literature how I can do the first getMap (or defineMap?? link) so that if several processes do this concurrently only one of them will actually create it and the others will wait until it finishes and get the object. Any ideas?  |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 21, 2016 12:57 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
hopsala wrote: |
Thanks fjb! That's exactly what I needed So all locking features are included in IIB 10?
(I'm asking because I remember reading that not all Extreme Scale features are available with base IIB 10 without purchasing an additional license)
After digging in the literature quite a bit, I see that doing a refresh, like you said, would be easy - I can simply update the cache and commit it only when I'm done, so I get an atomic action.
But I still can't figure out how to do the initial load. I can't see anywhere in the literature how I can do the first getMap (or defineMap?? link) so that if several processes do this concurrently only one of them will actually create it and the others will wait until it finishes and get the object. Any ideas?  |
I think that you would need a specific entry to the map to be set by the refreshing process. The process should check if an entry is present. If none is present write into the map its identity.
Once the process wrote this entry into the map it must query it. If the identity matches go ahead and update the map. If the identity does not match, you lost a race condition and another process is already updating the map. Once the update is complete remove the entry from the map.
This guarantees a minimum of serialization. Depending on the size of the map you could have one entry per map area to be refreshed... and so on...
Hope it helps  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|