You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Debasis Bhattacharyya <de...@yahoo.com> on 2008/05/15 16:46:53 UTC

JCS data retrieval is slower than database!!

Hi,
   
  I am trying to get a grip over JCS. I am able to get it working but not sure what I am doing wrong. I am putting 1000 objects in JCS. While retrieving these data, JCS is giving slower performance than what database is giving. Following is my configuration file. Any idea, tip, suggestion is greatly appreciated. Also, could you refer me to any study material about JCS. The terminologies like region, LTCP, DC are not very clear to me.
   
  # DEFAULT CACHE REGION
  jcs.default=DC,LTCP
  jcs.default.cacheattributes=
    org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=10000
jcs.default.cacheattributes.MemoryCacheName=
    org.apache.jcs.engine.memory.lru.LRUMemoryCache
  # PRE-DEFINED CACHE REGIONS
  jcs.region.testCache1=DC,LTCP
jcs.region.testCache1.cacheattributes=
    org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
jcs.region.testCache1.cacheattributes.MemoryCacheName=
    org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.testCache1.elementattributes.IsEternal=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=C:/Debs/cache
jcs.auxiliary.DC.attributes.maxKeySize=100000
  jcs.auxiliary.LTCP=
    org.apache.jcs.auxiliary.lateral.LateralCacheFactory
jcs.auxiliary.LTCP.attributes=
    org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
jcs.auxiliary.LTCP.attributes.PutOnlyMode=false

       

RE: JCS data retrieval is slower than database!!

Posted by Jorge Medina <jm...@e-dialog.com>.
If you just want a memory-only cache, then you do not need Disk Cache
(DC) nor lateral cache (LTCP).

As for the concepts, they are explained at
http://jakarta.apache.org/jcs/getting_started/intro.html

-----Original Message-----
From: Debasis Bhattacharyya [mailto:debsonchat@yahoo.com] 
Sent: Thursday, May 15, 2008 10:47 AM
To: jcs-users@jakarta.apache.org
Subject: JCS data retrieval is slower than database!!

Hi,
   
  I am trying to get a grip over JCS. I am able to get it working but
not sure what I am doing wrong. I am putting 1000 objects in JCS. While
retrieving these data, JCS is giving slower performance than what
database is giving. Following is my configuration file. Any idea, tip,
suggestion is greatly appreciated. Also, could you refer me to any study
material about JCS. The terminologies like region, LTCP, DC are not very
clear to me.
   
  # DEFAULT CACHE REGION
  jcs.default=DC,LTCP
  jcs.default.cacheattributes=
    org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=10000
jcs.default.cacheattributes.MemoryCacheName=
    org.apache.jcs.engine.memory.lru.LRUMemoryCache
  # PRE-DEFINED CACHE REGIONS
  jcs.region.testCache1=DC,LTCP
jcs.region.testCache1.cacheattributes=
    org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
jcs.region.testCache1.cacheattributes.MemoryCacheName=
    org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAtt
ributes
jcs.region.testCache1.elementattributes.IsEternal=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=C:/Debs/cache
jcs.auxiliary.DC.attributes.maxKeySize=100000
  jcs.auxiliary.LTCP=
    org.apache.jcs.auxiliary.lateral.LateralCacheFactory
jcs.auxiliary.LTCP.attributes=
    org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
jcs.auxiliary.LTCP.attributes.PutOnlyMode=false

       

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: JCS data retrieval is slower than database!!

Posted by Niall Gallagher <ni...@switchfire.com>.
Hi Debassis,

JCS retrieval speed for us is 60% slower than retrieving from our
database, when objects must be fetched from a remote cache. We don't
actually use the disk cache.

The point of caching is that you want to keep frequently used data close
to where it's used.

In your test, you are putting 1000 objects in a disk and lateral cache,
and then you are subsequently retrieving those objects from the cache.

But how many times do you retrieve each object from the cache in your
test?

Let's say n = "retrieval iteration"

For us, when n = 1: retrieval speed is 60% slower than the database
when n = 2,3,4,5 -> infinity: retrieval speed is 16 times faster than
the database

For static data (which you'll most want to cache), n will tend towards
infinity as time progresses, therefore if your systems are anything like
ours you should see 16X speedup in data retrieval time and (approaching)
a 100% reduction in requests for static hitting the DB.

For non-static data (e.g. user account data in our case), n for us tends
to be about 4 (4 repeated reads per hour). This gives us a 1.5X speed
increase in retrieving non-static data, since when n=1 we have the
overhead of retrieving from a remote cache or the database but when n >
1 retrieval speed is much faster.

The general cacheability formula as I call it is:

cacheability = 1 - ( 1 / n)

.where...

        n = number of times same database record will be read, and...
        cacheability = the cache hit rate which will be achieved, also
        the percentage by which load on database will be reduced


Note that we are just using memory cache and the remote cache server.
In our configuration, when n = 1 (and therefore data cannot be already
cached) our apps must fetch it from our remote cache server (which is
slow) or load it from the database and put it into the cache (which is
slow). In our configuration, when n = 2 JCS already has the data in
local ram therefore the retrieval is very fast. You might want to set up
some memory caching also as that's what really improves speed for us.

Good luck!

Niall

On Thu, 2008-05-15 at 07:46 -0700, Debasis Bhattacharyya wrote:

> Hi,
>    
>   I am trying to get a grip over JCS. I am able to get it working but not sure what I am doing wrong. I am putting 1000 objects in JCS. While retrieving these data, JCS is giving slower performance than what database is giving. Following is my configuration file. Any idea, tip, suggestion is greatly appreciated. Also, could you refer me to any study material about JCS. The terminologies like region, LTCP, DC are not very clear to me.
>    
>   # DEFAULT CACHE REGION
>   jcs.default=DC,LTCP
>   jcs.default.cacheattributes=
>     org.apache.jcs.engine.CompositeCacheAttributes
> jcs.default.cacheattributes.MaxObjects=10000
> jcs.default.cacheattributes.MemoryCacheName=
>     org.apache.jcs.engine.memory.lru.LRUMemoryCache
>   # PRE-DEFINED CACHE REGIONS
>   jcs.region.testCache1=DC,LTCP
> jcs.region.testCache1.cacheattributes=
>     org.apache.jcs.engine.CompositeCacheAttributes
> jcs.region.testCache1.cacheattributes.MaxObjects=1000
> jcs.region.testCache1.cacheattributes.MemoryCacheName=
>     org.apache.jcs.engine.memory.lru.LRUMemoryCache
> jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
> jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
> jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
> jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
> jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
> jcs.region.testCache1.elementattributes.IsEternal=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=C:/Debs/cache
> jcs.auxiliary.DC.attributes.maxKeySize=100000
>   jcs.auxiliary.LTCP=
>     org.apache.jcs.auxiliary.lateral.LateralCacheFactory
> jcs.auxiliary.LTCP.attributes=
>     org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
> jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
> jcs.auxiliary.LTCP.attributes.PutOnlyMode=false
> 
>        

Re: JCS data retrieval is slower than database!!

Posted by Aaron Smuts <as...@yahoo.com>.
What is the log level set to?  You cannot run JCS in
debug.  

When debugging a problem, it's generally best to
isolate and then expand out.  Test with the simplest
configuration and then then add more if you don't see
the problem.  You should try testing without disk or
lateral auxiliaries.  . . .

DC and LTCP are simply logical names for the
auxiliaries.  They could be called anything.  The name
is specified in auxiliary configuration.  Try going
over the documentation again.  If it's not clear, then
ask a more specific question.

Aaron


--- Debasis Bhattacharyya <de...@yahoo.com>
wrote:

> Hi,
>    
>   I am trying to get a grip over JCS. I am able to
> get it working but not sure what I am doing wrong. I
> am putting 1000 objects in JCS. While retrieving
> these data, JCS is giving slower performance than
> what database is giving. Following is my
> configuration file. Any idea, tip, suggestion is
> greatly appreciated. Also, could you refer me to any
> study material about JCS. The terminologies like
> region, LTCP, DC are not very clear to me.
>    
>   # DEFAULT CACHE REGION
>   jcs.default=DC,LTCP
>   jcs.default.cacheattributes=
>     org.apache.jcs.engine.CompositeCacheAttributes
> jcs.default.cacheattributes.MaxObjects=10000
> jcs.default.cacheattributes.MemoryCacheName=
>     org.apache.jcs.engine.memory.lru.LRUMemoryCache
>   # PRE-DEFINED CACHE REGIONS
>   jcs.region.testCache1=DC,LTCP
> jcs.region.testCache1.cacheattributes=
>     org.apache.jcs.engine.CompositeCacheAttributes
>
jcs.region.testCache1.cacheattributes.MaxObjects=1000
>
jcs.region.testCache1.cacheattributes.MemoryCacheName=
>     org.apache.jcs.engine.memory.lru.LRUMemoryCache
>
jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
>
jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
>
jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
>
jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
>
jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
>
jcs.region.testCache1.elementattributes.IsEternal=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=C:/Debs/cache
> jcs.auxiliary.DC.attributes.maxKeySize=100000
>   jcs.auxiliary.LTCP=
>    
> org.apache.jcs.auxiliary.lateral.LateralCacheFactory
> jcs.auxiliary.LTCP.attributes=
>    
>
org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
>
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
>
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
> jcs.auxiliary.LTCP.attributes.PutOnlyMode=false
> 
>        


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org