jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niall Gallagher <ni...@switchfire.com>
Subject Re: JCS data retrieval is slower than database!!
Date Thu, 15 May 2008 17:58:25 GMT
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
> 
>        

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message