tags:

views:

324

answers:

7

I am at a point where I need to take the decision on what to do when caching of objects reaches the configured threshold.

Should I store the objects in a indexed file (like provided by JCS) and read them from the file (file IO) when required or have the object stored in a distributed cache (network, serialization, deserialization)

We are using Solaris as OS.

============================

Adding some more information.

I have this question so as to determine if I can switch to distributed caching. The remote server which will have cache will have more memory and better disk and this remote server will only be used for caching.

One of the problems we cannot increase the locally cached objects is , it stores the cached objects in JVM heap which has limited memory(using 32bit JVM).

========================================================================

Thanks, we finally ended up choosing Coherence as our Cache product. This provides many cache configuration topologies, in process vs remote vs disk ..etc.

A: 

You're almost certainly guaranteed to be faster cacheing the data in a file as opposed to across the network.

McWafflestix
A: 

I don't get the question. Do you need a distributed cache, or not? Just answer this question to find out what you need.

Pascal Thivent
+1  A: 

Do you expect that the distributed nodes will keep your data in memory? I wouldn't.

If you can't be sure that the distributed nodes will keep your data in memory, then holding data on the network will take the time to read data from the disk, plus send the data over the network. Holding data locally will only take the time to read data from the disk.

Local is faster.

Chip Uni
The remote node might have enormous memory and/or a much faster disk system (perhaps solid state disk), whereas the local system could be a note book with a 5400rpm disk and inadequate memory.
Mark Thornton
Yes, the remote machine will store the data in cache. We will have multiple cache servers.
Kumar225
+2  A: 

The only way to really know is to test it, but with good network latency from your cache, it could well be faster than local disk access.

Once you are dealing with a large enough rate of cache requests, serialised random access to the local disk is likely to become a problem.

andrewmu
+2  A: 

It's going to depend on many things such as disk speed, network latency and the amount of data, so some experimentation might be the best way to get an idea. I recommend you have a look at http://ehcache.org/, it might come in handy.

Alb
A: 

The options are not mutually exclusive, there are products out there that combine both. Oracle Coherence for example can provide sophisticated distributed cache services with an option to overflow to disk when thresholds are exceeded.

David Soroko
A: 

Check out memcached, a distributed in-memory cache. You'll need to run performance comparisons for your own particular usages, but a distributed memory cache can often outperform a local disk cache.

Jim Ferrans