ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Locking mechanism in IIB 10 Global Cache

Post new topic  Reply to topic
 Locking mechanism in IIB 10 Global Cache « View previous topic :: View next topic » 
Author Message
hopsala
PostPosted: Mon Jun 20, 2016 5:43 am    Post subject: Locking mechanism in IIB 10 Global Cache Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Jun 20, 2016 9:13 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

You did read the document on extreme scale about locking strategies Yes?
http://www.ibm.com/support/knowledgecenter/SSTVLU_8.5.0/com.ibm.websphere.extremescale.doc/cxslockstrategy.html

If you need a specific lock for initialization wait, you could create a specific entry for that and as long as it is populated, not by your own data... wait until it is removed...???

For refreshes the locking strategy should take care of it...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
hopsala
PostPosted: Mon Jun 20, 2016 10:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 21, 2016 12:57 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Locking mechanism in IIB 10 Global Cache
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.