2 Replies Latest reply on Aug 6, 2004 4:11 AM by tomerbd

    JMX Performance


      I have done some performance tests and have compared two scenarios.

      1. Getting 100,000 times 8 properties from an mbean.
      2. Getting 100,000 times 8 propeties by a simple getter method.

      My results are like this :

      10:55:08,535 INFO [STDOUT] property Time :31 msec
      10:55:44,913 INFO [STDOUT] JMX Time :36378 msec

      does that means I should cache the configuration properties i get from MBeans? or is there something bad with my code?

      A sample code of getting a property from an MBean that I used :

       public String getEmailProtocol() {
       String value = "imap";
       try {
       value = _mBeanServer.getAttribute(_objectName, "EmailProtocol").toString();
       } catch (AttributeNotFoundException e) {
       _log.error(e.getMessage(), e);
       } catch (InstanceNotFoundException e) {
       _log.error(e.getMessage(), e);
       } catch (MBeanException e) {
       _log.error(e.getMessage(), e);
       } catch (ReflectionException e) {
       _log.error(e.getMessage(), e);
       return (value);

        • 1. Re: JMX Performance
          Elias Ross Master

          There is some indirection and Reflection to get attributes. And there are some byte-code performance tricks which can optimize the call, if you hunt around you can find more data on this.

          If you are working within one JVM or with a serializeable object remotely, add a "getInstance" method which returns "this" and you don't have to call the MBeanServer.

          • 2. Re: JMX Performance

            Well im working on multiple jvm's and i want the updated properties (in case the user has updated them using the GUI/jboss-service.xml so i guess I'll have a listener to the mbean server and my regular method calls (property getters) will return some cached local variables...