transfer.com.Transfer will have a new method:
transfer.getCacheMonitor() : CacheMonitor
Which will return a CFC that allows access to introspect the cache.
Cache Monitor will have the following methods on it:
CacheMonitor
-------------------------
getCachedClasses() : array
An array of all the classes currently stored in the cache
getCacheSetting(class) : struct
Returns a struct that outlines what scope, maxtimeouts etc that
particular class is configured with.
Question: Is it okay to use a struct here? or do you want me to pass
back a CFC? Internally, this is all stored on Java objects, so it
seemed to make sense to expose this via a struct.
getHits(class) : numeric
The number of cache hits, for a particular class
getMisses(class) : numeric
The number of cache misses, for a particular class
getEstimatedSize(class) : numeric
This is a fast look at how many items in the cache, simply by checking
its size. It doesn't check to see if any of the softReferences have
been cleared.
getCalculatedSize(class) : numerica
This is a slow look at how many items are in cache, where it will take
a copy of the cache, and loop through, testing to see if any of the
softReferences have been cleared or not.
getTotalHits() : numeric
A loop around to get a total number of hits for all classes in the cache.
getTotalMisses() : numeric
A loop around to get the total number of misses across all classes in the cache.
getTotalEstimatedSize() : numeric
A loop around to get the total Estimated size.
getTotalCalculatedSize() : numeric
A loop around to get the total Calculated size.
I think that covers most things.. can anyone think of anything else
they would like to add / change / comment on?
Mark
Cheers,
Bob
--
Bob Silverberg
www.silverwareconsulting.com
Java doesn't give you a way to determine object memory size, so there
is really no way to determine what the size of objects are, byte wise.
Really, you are looking at Java Profiling tools to be able to do that.
Mark
Maybe... ;) how much would people want to be able to change their
cache settings at runtime tho'?
>
> Here are some funky ideas for you:
>
> - How many objects have been evicted by reaps
> - How many objects have been garbage collected by the jvm via the soft
> references
This may be a bit tricky to work out, as Transfer just clears the
softReference and enqueues it when discarding from timeouts... I'll
have to look into it. It should be possible to calculate reaps, but
maybe not GC'd objects.
> - hit vs miss ratio: getCacheRatio()
So -
getHitMissRatio(class) : numeric
getTotalHitMissRatio() : numeric
> - How about an array of class map reports that can show a class'
> performance: hits, misses, evictions, gc, class set timeout, class
> storage scope and calculate an efficiency for it. This can give good
> data as to how to tweak the cache on certain classes to modify their
> timeouts if necessary.
Well, if you have all the data we're talking about.. you only have to
loop around the getCachedClasses() array, and work it out... or you
want me to do that for you, is what you're saying?
I can't distinguish between SoftReference GC'd clearing and Transfer
cache explicitley clearing the soft references, so I'm amending the
API to just have a
getEvictions(class)
getTotalEvictions(class)
Which will include both GC'd and Settings based cache evictions.
Mark