The Problem?
For those of you who use caching with frameworks like Hibernate, Spring or anything else, you know what a pain performance tuning can be. The tools you have available for tuning, resource management and avoiding OOME's boil down to counts and age controls. These are actually not resource management controls at all. They are data freshness controls and should be treated as such.
How do you even begin to figure out how many entries to allow in each Hibernate cache when you have a hundred of them? What if things change and objects get bigger, or smaller. What if you change your heap size and/or usage patterns?
You've Gotta Try This...
With Ehcache 2.5 you can just specify a percentage of heap or a heap size in bytes that your graphs of Java objects are allowed to use. This is accomplished by passing a simple size description into a Cache or CacheManager. All objects held onto by the cache will borrow their space from the cache's or manager's specified pool. Entries will get evicted from the cache as space runs low without any intervention from the developer. This can be done at the Cache Tier level whether it's on heap, disk or BigMemory. It's another way to reduce tuning, improve performance while avoiding OOME's. Learn more here.
If you do things in config or in code it's just a one line change:
A few More Details...
It works on any 1.5 or 1.6 JVM (Tested on Oracle, JRocket and IBM). Doesn't require any object serialization for the on heap management.
Learn More:
Try it out and give us lots of feedback on the Terracotta Forums: