Hi Martin, Martin J. Wells wrote:
Correct. Cache synchronization (by means of PB.invalidate(oid)) between multiple OJB caches is only implemented for C/S mode.Hi all,I'm looking at using OJB for a high-load web app project and have a question relating to C/S distributed caching. My largest issue is performance on the app-server side. In the docs it seems to say that the PB client doesn't implement any caching of distributed objects (this is done only in server mode)? I've noted the following source for invalidate: public void invalidate(Identity oid) throws PersistenceBrokerException { // if running in servermode inform other caches if (isRunningInServerMode()) { // call all other servers in OJB cluster to remove Object // from theirs caches Iterator iter = getPool().getAllEntries(); while (iter.hasNext()) { ServerEntry entry = (ServerEntry) iter.next(); PersistenceBrokerClient client = new PersistenceBrokerClient(entry, getPBKey()); client.removeFromCache(oid); } } // if running in singlevm mode simply remove from local cache else { removeFromCache(oid); } }
C/S mode means: The PersistenceBroker client (in your case the SessionBean) is running in a different JVM than the PB server.
C/S mode is useful only if you want to scale the OJB backend. In your case you have already scaled the frontent (that is multiple EJB containers running your SessionBeans).
SO you don't need to introduce another scalable layer.
I agree. Using C/S mode in your case is IMO not an option. C/S mode is much slower (factor 10 - 100) than running OJB in singlevm mode.In my application's case, objects are typically bound to an app-server session, with a large number of updates occurring local to the session. However, there are exceptions where another app-server may do an update on such an object. In this case I (obviously) need to remotely invalidate the object. I'm trying to avoid having my app-servers (12 or so) all have to go across the network to get object data. We're talking about a *very* high event rate (~300-500 per sec), where the vast majority are on local session objects.
I recommend to implement a manual invalidation scheme. This is not that difficult, as OJB provides all you need.Is this possible? Can it be done by running the PB's on the app-servers in "server" mode? What are the operational consequences of running 12 "server" mode instances in parallel?
1.You'll need a special InvaldationSessionBean providing a method invalidate(Identity oid). (You could also use the PersistenceBrokerServer SessionBean implementation for this)
2. You'll have to maintain a list of all your appservers in the cluster
3. Once a server updates an Object belonging to another server you perform a remote call on 1.) to invalidate the objects.
If you don't need caching things are even more easy. You can have full synchronization by simply using optimistic locking.
cheers,
Thomas
Thanks in advance for any comments. Regards, Marty -- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
-- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
