In my experience, one particular setting has proven to be the most difficult to find the correct setting for: MaxObjects.
I should qualify that I have a pretty specialized setup: I have about 100 regions with the capacity to generate many more objects than I have room for, despite having 1.8gig of memory available, and that these objects get generated once, read all the time, and are changed almost never. Latency is our primary enemy, but even a remote cache get is significantly faster than 'doing the work'. The LRU is ideal for our settings because the most common items stay in memory indefinitely (maxTime of several months) while idle and infrequently used objects will drop out. Unfortunately for any given region the size of a given cached objects varies pretty wildly, thus forming the basis for my dilemma. The problem is that in peek times the cache can do one of two things: Load itself up with small objects, hitting MaxObjects and stopping, thus not making use of the available resources and incurring additional (and unnecessary) load on the rest of the infrastructure (disk, remote cache, and the DB); Or it loads itself up with large objects and runs out of memory before hitting MaxObjects. The obvious solution here is (in my scenario) to replace MaxObjects with MaxMemory. Unfortunately this is, of course, easier said than done. The only option I've encountered so far is to Serialize the object, and even that's only a rough guess of what it's actually taking up in memory. This adds the overhead of Serialization to the size and doesn't account for transient fields, which definitely do take up space in memory. Of course if we're already doing this for 'Deep Copy' it may be a non-issue. The other solution I thought of was using (Runtime.totalMemory()-Runtime.freeMemory()). When this number dips below a threshold, the Memory Cache can't grow any further (which is the same as if we've reached MaxObjects). This is perfect for my purposes, and actually provides a more accurate heuristic of memory utilization, even if it's a less fine grained one. Thoughts? Comments? Suggestions? Screams of agony? Does anyone else think this might be useful or am I just off on a tangent? -Travis Savo <[EMAIL PROTECTED]> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
