JDK-4619006 : RFE: MBeanServerImpl should use caching in invoke()
  • Type: Enhancement
  • Status: Resolved
  • Resolution: Fixed
  • Component: core-svc
  • Sub-Component: javax.management
  • Priority: P5
  • Affected Version: 2.0
  • OS: generic
  • CPU: generic
  • Submit Date: 2002-01-03
  • Updated Date: 2005-09-17
  • Resolved Date: 2005-09-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 6
6 b53Resolved
Description
In reflection there are two things that needs to be done in order to
invoke a method on an object: lookup the method, and invoke it on the
object. The latter is fast, the former is slow. Method lookups in
invoke() are not cached, hence seriously impacting the performance of
MBeanServer.invoke().

Comments
EVALUATION Looking up cached methods is faster even for operations because it avoids having to load each class named in the String[] signature array from MBeanServer.invoke. This optimization is now implemented with common code for Standard MBeans and MXBeans that finds Method objects in Maps. For invoke, it is only necessary to compare the received signature array with the signature array of the previously-discovered operation (or operations, in case of overloading). A simple microbenchmark that calls MBeanServer.getAttribute on a Standard MBean 100000 times in a tight loop (measured after "warming up" the JVM by first repeatedly executing the test code without measuring) shows a reduction from 918 ms to 246 ms, i.e. about 270% faster.
2005-09-09

EVALUATION ###@###.### 2002-01-04 Not a bad idea, but I am not sure looking up in the cache will be faster than lookup in the Class, at least for operations. For attributes, caching the getter/setter is probably a good idea, although the impact on memory footprint must be kept in mind. Since the invoke() is now performed by the Metadata, we can imagine to provide several implementation of MetadataImpl and let the user choose which one he wishes to use.
2004-09-01

PUBLIC COMMENTS .
2004-09-01