Hi all,

In the efforts to improve Jahia's clustering support, I've had to make a change to the current cache implementation. Basically up until version 4.0.4 Jahia was synching caches only by sending through the network the cache keys that had changed, invalidating them through the cluster. Unfortunately this was sub-optimal as it was causing "bounce back" effects, because other servers would then reload the entry, and causing the original server to flush it's key, and so forth.

Because of this problem I changed the cache implementation to know send the actual key AND value through the network. At first I anticipated performance problems but it seems that this approach doesn't even show up on OptimizeIt. The really nice side effect of this change is that if one server loads an object from the database, automatically all the other servers will get a copy. And also if one server updates it's HTML cache, all the other servers will also include a copy of the generated page, making next accesses on any server possibly quite efficient.

The main reason I'm writing is because from now on, if you are doing low-level work with Jahia (I don't know everybody that's out there, hence my writing here), you will have to change your implementations so that you always update the cache when doing changes to cached objects. Up until now it was allowed to do something like this :

Object targetObject = cache.get(targetObjectKey);
targetObject.modify()

This worked in a single node installation, but in clustering causes problems. Therefore all these kinds of calls must be changed to :

Object targetObject = cache.get(targetObjectKey);
targetObject.modify()
cache.put(targetObjectKey, targetObject);

The last line will send the updated object through the cache, making sure that all servers are coherent. So what I'm asking is that all upcoming contributions and developments follow this (simple) rule of thumb, so that we may all benefit from these changes.

Regards,
  Serge Huber.


- -- --- -----=[ serge.huber at jahia dot com ]=---- --- -- -
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company





Reply via email to