Return-Path: Delivered-To: apmail-jakarta-jcs-users-archive@www.apache.org Received: (qmail 42606 invoked from network); 5 Jul 2005 14:22:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2005 14:22:57 -0000 Received: (qmail 67384 invoked by uid 500); 5 Jul 2005 14:22:56 -0000 Delivered-To: apmail-jakarta-jcs-users-archive@jakarta.apache.org Received: (qmail 67350 invoked by uid 500); 5 Jul 2005 14:22:55 -0000 Mailing-List: contact jcs-users-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JCS Users List" Delivered-To: mailing list jcs-users@jakarta.apache.org Received: (qmail 67327 invoked by uid 99); 5 Jul 2005 14:22:55 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jul 2005 07:22:55 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [68.142.200.121] (HELO web30508.mail.mud.yahoo.com) (68.142.200.121) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 05 Jul 2005 07:22:55 -0700 Received: (qmail 38203 invoked by uid 60001); 5 Jul 2005 14:22:51 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=UtUcjLLPpf1tvDKYhLeQENtClpy71UVskVCWl9JiLyfie0DGN5kWNFuDd/7/W+7hQq7gdZgBsF2ksrfEYrbra6gfrtSMPGMg97Zoc96HLWvqHgXtjkNxdlXjnKDyBbgrMLEjxR2SeabEc1dl29jCRhMoT1aAmfvMYZeZjdv6OO8= ; Message-ID: <20050705142251.38201.qmail@web30508.mail.mud.yahoo.com> Received: from [209.11.64.195] by web30508.mail.mud.yahoo.com via HTTP; Tue, 05 Jul 2005 07:22:51 PDT Date: Tue, 5 Jul 2005 07:22:51 -0700 (PDT) From: Aaron Smuts Subject: Re: JCS Performance test To: JCS Users List In-Reply-To: <1120553245.5882.48.camel@trax3> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Also, what log level do you have set for JCS? Don't try to run with the log level at debug. Info should be fine. I run at warn in prod. . . --- Thomas Rasmussen wrote: > Hi, > > like saipradeep I'm new to JCS. > > I've read the document on JCS written > by Aaron Asmuts. > Trying to play with the example application > from that document (the book store example), > I've adopted the code to fit into the needs > of the project I'm currently working on. > > To test the performance of the application, > basically I collect some data from the database, > knowing that the cache is empty at this point. > > Immediately after that, I query all the objects > using exactly > the same keys as the database query, and sure enough > the application finds them all in the cache. > The Ant log file shows that during the first > operation > there are only "misses" and during the second > obviously only hits. > > Now, when timing these two actions (getting all > the information from the db and after that reading > it all from the cache) the cache access is only > faster if I create a small number of objects (some > 250). > By that point the cache access continues to grow > slower > than the direct database access. > > Raising the available amount of memory, like this: > > java -Xms128M -Xmx256M myClass > > > didn't affect this unsatisfying behavior in any way. > Initially > I tried to create about 8600 objects (small objects > having only 5 fields containing information about > airports) which I subsequently accessed directly > from > the cache. Constructing the objects was no problem, > but > reading from the cache was extremely slow and after > some > 20 min, I broke off this action, having "read" only > about 2000 > objects ! (my workstation is a dell 1.8 Ghz computer > with 512 MB RAM) > > > My cache.ccf file looks like this: > > # DEFAULT CACHE REGION > > jcs.default=DC > jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes > JCS.default.cacheattributes.MaxObjects=10000 > jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache > jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes > jcs.default.elementattributes.IsEternal=false > jcs.default.cacheattributes.maxMemoryIdleTimeSeconds=3600 > jcs.default.elementattributes.maxLifeSeconds=3600 > jcs.default.elementattributes.IdleTime=1800 > jcs.default.elementattributes.IsSpool=true > jcs.default.elementattributes.IsLateral=false > jcs.default.elementattributes.IsRemote=false > > > > # PREDEFINED CACHE REGIONSInicially > > jcs.region.testCache1=DC > jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes > jcs.region.testCache1.cacheattributes.MaxObjects=10000 > jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache > jcs.region.testCache1.cacheattributes.maxMemoryIdleTimeSeconds=7200 > jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes > jcs.region.testCache1.elementattributes.IdleTime=1800 > jcs.region.testCache1.elementattributes.IsEternal=false > jcs.region.testCache1.elementattributes.IsSpool=true > jcs.region.testCache1.elementattributes.IsLateral=false > jcs.region.testCache1.elementattributes.IsRemote=false > > > > #### AVAILABLE AUXILIARY CACHES > > jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory > jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes > jcs.auxiliary.DC.attributes.DiskPath=/tmp/jcs/raf > jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000 > jcs.auxiliary.DC.attributes.MaxKeySize=10000 > jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000 > jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500 > > > > The main class is, though adapted, pretty much kept > as the example > code by Aaron Asmuts (I apologize for the > bad format of the code that might be caused by my > email client): > > > public class AirportObjManager { > > private static AirportObjManager instance; > private static int checkedOut = 0; > private static JCS airportCache; > private DatabaseManager db; > > > private AirportObjManager() { > > try { > airportCache = JCS.getInstance("testCache1"); > } > catch (Exception e) { > System.out.println("Error trying to initialize > the cache region."); > e.printStackTrace(); > } > } > > > /* Accesspoint */ > public static AirportObjManager getInstance() { > > synchronized (AirportObjManager.class) { > if (instance == null) { > instance = new AirportObjManager(); > } > } > > synchronized (instance) { > checkedOut++; > } > > return instance; > } > > > /** > * @param airportCode > * @return AirportObj > */ > public AirportObj getAirportObj(String airportCode) > { > > return getAirportObj(airportCode, true); > } > > > /** > * @param airportCode > * @param fromCache > * @return AirportObj > */ > public AirportObj getAirportObj(String airportCode, > boolean fromCache) { > > AirportObj airObj = null; > > if (fromCache) { > airObj = (AirportObj) > airportCache.get(airportCode); > } > > if (airObj == null) { > //System.out.println("Says the getAirportObj > Method: > Object" > + airportCode + " not in cache, fetching from > database."); > > airObj = (AirportObj) loadAirportObj (airportCode); > } > return airObj; > } > > > /** > * loads the airport from the database > * and creates an object from it > * > * @param aCode > * @return AirportObj > */ > public AirportObj loadAirportObj(String aCode) { > > AirportObj airport_object = new AirportObj(); > boolean found = false; > > // Here I fetch the data from the db and > initialize > // the fields of the object with the values > } > === message truncated === --------------------------------------------------------------------- To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org For additional commands, e-mail: jcs-users-help@jakarta.apache.org