Re: Cache Issue in distributed environment
Armin Waibel <[email protected]> Wed, 12 Mar 2008 14:43:48 +0100
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Cedric, Cédric Talon wrote: > Hi, I am new on this mailing list and so it is my first message. > welcome to this list! > I am working on a project which is using OJB in a distributed > environment. The distributed issue is my problem ! I have read there > are important points to respect in this case. > > The first one is to use Sequence Manager. It's ok for me. > > The second one is the locking issue. I am using the > LockManagerRemoteImpl. So I think it is ok. Do you use the ODMG-api implementation? http://db.apache.org/ojb/docu/guides/odmg-guide.html Only this implementation supports pessimistic locking by default. The PB-api http://db.apache.org/ojb/docu/guides/pb-guide.html only supports optimistic locking by default. http://db.apache.org/ojb/docu/guides/lockmanager.html For best performance I would recommend to use optimistic locking (needs a 'version' column in the database table) for all concurrent modified persistence objects. > > The last point is the cache issue. And this is the subject of this > mail. Currently I am using ObjectCacheDefaultImpl. I know it is not > suitable for distributed environment. That's why I'd like to use > distributed cache. Here you can find a short description how the cache works http://www.mail-archive.com/[email protected]/msg16075.html My estimation is that in most cases OJB will benefit more from a fast DB/DB-cache/network (in combination with a session cache) than from a distributed cache (except you do a lot of "get object by identity" stuff). I would recommend to run some load tests with/without distributed cache. > > I have heard about OS Cache but it requires a multicast network. It > is not possible in my case. I have heard about JCS too. Has anybody > ever used it? Sorry, I don't have experience in this. > I don't find information to configure it with OJB. Can > anybody help me ? If you use OJB 1.0.5rc1 change the object-cache element within your jdbc-connection-descriptor to one global cache region: <object-cache class="JCS"> </object-cache> a cache region for each class: <object-cache class="JCSPerClass"> </object-cache> For version 1.0.4 specifiy the full qualified class name (e.g. org.apache.ojb.broker.cache.ObjectCacheJCSPerClassImpl). You can configure the JCS cache via the cache.ccf properties file. regards, Armin