Return-Path: Delivered-To: apmail-cocoon-docs-archive@www.apache.org Received: (qmail 59994 invoked from network); 8 Jun 2004 06:46:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Jun 2004 06:46:28 -0000 Received: (qmail 14698 invoked by uid 500); 8 Jun 2004 06:46:24 -0000 Delivered-To: apmail-cocoon-docs-archive@cocoon.apache.org Received: (qmail 14618 invoked by uid 500); 8 Jun 2004 06:46:23 -0000 Mailing-List: contact docs-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: docs@cocoon.apache.org Delivered-To: mailing list docs@cocoon.apache.org Received: (qmail 14487 invoked by uid 99); 8 Jun 2004 06:46:22 -0000 Received: from [157.193.121.51] (HELO otsrv1.iic.ugent.be) (157.193.121.51) by apache.org (qpsmtpd/0.27.1) with ESMTP; Mon, 07 Jun 2004 23:46:22 -0700 Received: from otsrv1.iic.ugent.be (localhost [127.0.0.1]) by otsrv1.iic.ugent.be (8.11.6/8.11.6) with ESMTP id i58404v15771 for ; Tue, 8 Jun 2004 06:00:05 +0200 Date: Tue, 8 Jun 2004 06:00:05 +0200 Message-Id: <200406080400.i58404v15771@otsrv1.iic.ugent.be> From: stevenn@outerthought.org To: docs@cocoon.apache.org Subject: [WIKI-UPDATE] UsingOJBWithJCS Tutorials OJBBlock Tue Jun 8 06:00:04 2004 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Page: http://wiki.cocoondev.org/Wiki.jsp?page=UsingOJBWithJCS , version: 1 on Mon Jun 8 04:11:35 2004 by AntonioGallardo New page created: + !!!Using OJB with JCS. + + This page will explain you in 4 steps how to configure [Apache JCS|http-link-tojakarta.apache.org/turbine/jcs/] as Object Cache for OJB in Cocoon. + + !!Prerequisites + * You have already [configured OJB|OJBBlock] + + !!Facts + *Object Cache helps to improve the database performance. + *OJB is able to use different Object Cache Implementations. + *The default OJB Object Cache Implementation is fast, but has [few drawbacks|http-link-todb.apache.org/ojb/objectcache.html#Shipped%20cache%20implementations] + *Since Cocoon 2.1.5 the default cache implementation is based in Apache JCS. + *Apache JCS is a distributed caching system for server-side java applications. It is far more powerful. + + !!Platform + I think it works in any configuration, but just in case, here is the tested platform: + + * Linux Fedora Core 2 + * J2SDK 1.4.2_04 + * Apache Tomcat 5.0.24 + * Cocoon 2.1.5 + + !!Steps + + !1. Let your servlet breathe calm + My first attempt to setup this configuration failed because of a {{OutOfMemoryError}}. The problem showed to be that the servlet does not had enough memory to run. ie: add this lines in {{catalina.sh}}: + + {{{ + # Set Java Options + JAVA_OPTS='-Xms32m -Xmx128m' + if [ -r "$JAVA_OPTS"/bin/setenv.sh ]; then + . "$JAVA_OPTS"/bin/setenv.sh + fi + }}} + + !2. Tell OJB we will use JCS + In your {{OJB.properties}} file, find the __Object Cache__ section. Comment the line where is {{ObjectCacheDefaultImpl}} and uncomment the line where is {{ObjectCacheJCSPerClassImpl}}. ie: + + {{{ + #------------------------------------------------------------------- + # Object cache + #------------------------------------------------------------------- + ... + #ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl + ... + ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheJCSPerClassImpl + }}} + + !3. Tell Cocoon that OJB will use JCS + Cocoon is shipped with a default JCS configuration. Cocoon allow to define new cache regions for JCS via {{cocoon.xconf}}. We need to configure the default region used by the JCS ObjectCache implementation for OJB. Search and add this parameters: + + {{{ + + + + + + + + + }}} + + The last 4 parameters (starting with __jcs.region.ojbDefault__) define the cache region that OJB will use. + You can tell JCS how many OJB Object will be able to cache by changing the value of the parameter {{jcs.region.ojbDefault.cacheattributes.MaxObjects}} + + !4. That is all! + + Now restart you Tomcat and start using JCS. you will notice performance improvement. Good Luck! + + !!More info: + * [Cocoon Store|http-link-tococoon.apache.org/2.1/developing/stores.html] - What are the stores in Cocoon? + * [JCS Logging] - How to redirect the JCS messages to a file (very easy too!) + + -- [Antonio Gallardo] + Page: http://wiki.cocoondev.org/Wiki.jsp?page=Tutorials , version: 76 on Mon Jun 8 03:31:37 2004 by 24.91.189.219 - * [Presentation on Cocoon Web Publishing framework with example|http-link-to-subrahmanya.50megs.com/publishdocs/Cocoonp.ppt] -- An Technical Presentation Given by [Subrahmanya Nayak|http-link-to-www.subrahmanya.50megs.com/] ! Currently not reachable (forbidden access) ? -------------------------------------------- + * [Presentation on Cocoon Web Publishing framework with example|http-link-to-subrahmanya.50megs.com/publishdocs/Cocoonp.ppt] -- An Technical Presentation Given by [Subrahmanya Nayak|http-link-to-www.subrahmanya.50megs.com/] Page: http://wiki.cocoondev.org/Wiki.jsp?page=OJBBlock , version: 12 on Mon Jun 8 04:39:05 2004 by AntonioGallardo - __See Also__: [OJBWithJDO] + __See Also__: [OJBWithJDO], [UsingOJBWithJCS]