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: Implementing Remote Cache using JCS .
Date Mon, 16 Mar 2009 18:12:13 GMT
Hi Yaswanth,

"my average retrieval time is 2.3 Seconds"
-is that 2.3 seconds per object or 2.3 seconds per 10,000 objects?

Whichever the case- I'd not expect retrieval time from a remote cache
server to be faster than say retrieving from a database, if that's what
you're comparing with. The point of JCS is not to compete with database
drivers in network round-trip retrieval speed. The point is to eliminate
network round trips.

If, in your test, one server is putting an object into the cache and you
are timing how long it takes the other server to retrieve it, you won't
be getting real-world statistics. You should time how long it would take
the second server to retrieve the same object multiple times, which is
what your app would probably be doing in production (if your data is
cacheable i.e. is repeatedly read more than once). Also you should have
a warm-up run in your test because initialising the cache takes a couple
of seconds but only happens at application startup.

The remote cache server is not a distributed cache by itself - it exists
to *coordinate* the distributed cache. The JCS client libraries which
you'll have in each application connect to and retrieve objects from the
remote cache server and then keep copies in local RAM to allow them to
avoid network round trips when they next need the same data. The remote
cache in the meantime keeps each client in sync with other clients by
notifying clients when data changes.

If n=retrieval iteration, you'll probably find that when

n=1, timetaken=0.5 seconds
n=2, timetaken=0.00004 seconds
n=3, timetaken=0.00004 seconds
..and so on.

Then you need to run the same test, but this time comparing time taken
when you repeatedly read from a busy database. Databases have built-in
caches, so for n=2 you'll see a slight improvement, but it will still be
at least hundreds of times slower than retrieving from local RAM.

Kind regards,


On Mon, 2009-03-16 at 08:58 -0700, Yaswanth wrote:

> Hi, 
> I am trying to implement Remote Cache using JCS.
> Below is my Server and Client Code. Here are my 
> http://www.nabble.com/file/p22541185/remote.cache.server.ccf Server   and 
> http://www.nabble.com/file/p22541185/remote.cache.client.ccf Client  Cache
> configuration files.
> My ServerCode :
> RemoteCacheServerFactory.main(new String[]{"/remote.cache.server.ccf"});
> My Client1 Code :
> JCS.setConfigFilename( "/remote.cache.client.ccf" );
> JCS cache = JCS.getInstance( "testCache" );
> cache.put("Key"+i, "Value"+i); // So many times.. While loop
> My Client2 Code :
> JCS.setConfigFilename( "/remote.cache.client.ccf" );
> JCS cache = JCS.getInstance( "testCache" );
> cache.get("Key"+i); // So many times. While loop
> I am running a JCS Remote Server and Starting Two Remote Clients.
> Using One client i am adding 10K Objects into  cache and after that i am
> using using another client i am retrieving them. At this time my average
> retrieval time is 2.3 Seconds.
> When i rerun the test case with 100K objects . My average retrieval rate is 
> 302 Seconds.
> I observed that my retrieval rates are very slow, which i think shouldn't
> be. Can anyone point out where the problem is ?
> Thanks,
> Yaswanth

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