Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much data is too much for on-heap java cache? When should I start to think about off-heap cache?

How much data is too much for on-heap cache like ehcache?

I'm getting a 24GB RAM server. I'll probably start off devoting 2-4 GB for caching but may end up devoting 20GB or so to cache. At what point should I worry that GC for on-heap cache will take too long?

By the way, is DirectMemory the only open source off-heap cache available? Is it ready for prime time?

like image 846
Continuation Avatar asked Jan 20 '12 04:01

Continuation


People also ask

How much data can a cache store?

Your cache can grow to almost any size as long as you have the RAM to handle it so 30 MB won't be a problem unless you are on a very limited device. You can specify an optional "size" limit on your MemoryCache instance, but that is optional and defaults to there being no limit.

What is heap cache?

On-heap cache is the portion of a cache that resides within the heap of the JVM where the Integration Server is running. On heap-cache is fast, but because it resides within the heap space, it is subject to the garbage collection process.

How does Java cache memory work?

The Java Object Cache is an in-process, process-wide caching service for general application use. That is, objects are cached within the process memory space, and the Java Object Cache is a single service that is shared by all threads running in the process, in contrast to a service that runs in another process.

Which tool is a off-heap cache for the Java Virtual Machine?

Geode can be configured to store region values in off-heap memory, which is memory within the JVM that is not subject to Java garbage collection.


2 Answers

Depends on your JVM and especially the used GC. Older GCs especially were not really capable of handling really large heaps, but there's been an increasing effort to fix that.

Azul systems for example sells hardware with hundreds of GB of heap without problems (ie gc pauses in the ms not half minutes) thanks to their special GC, so it's no limitation of Java per se. No idea how good hotspot/IBM have got over time though. But then a 24gb heap isn't that large anyhow - G1 should probably do a good enough job there anyhow.

like image 63
Voo Avatar answered Oct 23 '22 13:10

Voo


At what point should I worry that GC for on-heap cache will take too long?

How long is too long?

Seriously, if the you are running a "throughput" garbage collector and this is giving you pauses that are too long, then you should try switching to a low-pause collector; e.g. CMS or G1.

like image 42
Stephen C Avatar answered Oct 23 '22 15:10

Stephen C