[
http://jira.jboss.com/jira/browse/JBCACHE-11?page=comments#action_12348184 ]
Elias Ross commented on JBCACHE-11:
-----------------------------------
I was thinking of implementing something like this, since it's fairly straightfoward.
Or so I thought....
Eviction based on, say a fraction of total free memory, would make sense. In Java 1.5, it
is easy to get the MXBean that return heap information, etc.
What users might want to do is specify how much memory is allocated for a particular cache
(region), or to a percentage of the maximum heap storage for caching... not to simply
evict on some arbitrary percentage of memory free. Somehow this seems a bit unstable.
If it were possible, calcuating a cache's exact memory footprint would be ideal. I
believe, though, with some sort of sampling (and maybe by serializing the data itself), a
"good enough" estimate could be obtained. And actually, providing an estimated
size of the cache (in bytes) would be useful to know as a user. For commonly-kept objects
(such as "String" or "integer"), using the Java "SizeOf"
program should produce a good size estimate of these types. Sampling should be done
randomly, of course, and if just perhaps 1% of the objects were sampled,
Memory based eviction policy
----------------------------
Key: JBCACHE-11
URL:
http://jira.jboss.com/jira/browse/JBCACHE-11
Project: JBoss Cache
Issue Type: Feature Request
Affects Versions: 2.0.0.GA
Reporter: Bela Ban
Assigned To: Ben Wang
Priority: Optional
Fix For: 2.1.0.GA
Original Estimate: 2 weeks
Remaining Estimate: 2 weeks
(maybe only in JDK 1.5, which has
triggers for low memory)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira