Jim Menard wrote:
We're using JRuby in an app server, and the app server needs to keep
track of the sizes of running applications within it while running for
monitoring, to detect leaks, and to limit resources if necessary. What
I'm looking for is a way to write a method in Java that returns the
approximate size of an org.jruby.Ruby instance (and, if possible the
total size of all the Ruby objects in ObjectSpace).
It sounds like there's nothing like that available within JRuby itself
(nor do I see anything like it in my brief poking around in the source
code).
Nope, nothing like that comes to mind, and ObjectSpace is normally
disabled (being a tremendous perf and memory load to track every object
created).
There's certainly a gap of sorts here in Java memory monitoring, since
most apps do whole-heap measurements. I suppose the complexity is how to
isolate a subgraph of the in-memory objects, since there's often
cross-links.
Still seems to me like one of the available Java tools ought to be able
to do this, perhaps through JVMTI walking objects on the heap and making
estimates (or accurate measurements) of the size of each. It would be
expensive though.
What may be needed here is the long-awaited JVM MVM support, which can
partition a given process space into multiple independent VMs. Assuming
the overhead of each sub-VM was low, you could deploy the apps into
their own sub-VMs and then query the subVM for its total memory statistics.
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email