0 Replies Latest reply on Jan 3, 2010 10:48 PM by Daniel Bevenius

    Performance: XMLBeans vs JAXB

    Daniel Bevenius Master
      I've been looking into startup and deployment time as part of the ongoing performance work that David and I are working on.
      I wanted to see if replacing XMLBeans, which is used for the internal configuration model (jboss-esb.xml), with JAXB would help improve our startup and deployment time.
      First lets look at the startup time, and begin with the existing XMLBeans version.
      Below are the XMLBeans entries that showed up as hotspot when starting the application server with the default JBoss ESB services (i.e no custom .esb archives deployed). You can find the jprofiler results here.
      Startup of JBoss ESB on JBoss AS 4 using XMLBeans:
      org.apache.xmlbeans.impl.values.TypeStore.find_element_user(org.apache.xmlbeans.QNameSet, int)   241 ms (0 %) 45 invocations
      org.apache.xmlbeans.impl.values.TypeStore.find_element_user(javax.xml.namespace.QName, int)      205 ms (0 %) 237 invocations
      org.apache.xmlbeans.XmlBeans.getContextTypeLoader        172 ms (0 %) 15 invocations <-- soapui is responsible for the most of this time.
      org.apache.xmlbeans.impl.values.TypeStore.find_attribute_user    32,079 µs (0 %) 1 invocation
      Total time ≈ 446 ms
      Now, lets take a look at the same but this time using JAXB.
      Below are the JAXB entries that showed up as hotspot when starting the application server with the default JBoss ESB services (i.e no custom .esb archives deployed). You can find the jprofiler results here.
      Startup of JBoss ESB on JBoss AS 4 using jaxb:
      javax.xml.bind.JAXBContext.newInstance   1,016 ms (2 %) 1 invocation
      Total time = 1016 ms
      We can see that using JAXB actually increases the startup time, though please note that there is only a single invocation to create a JAXBContext, whereas the calls to the XMLBeans classes are multiple and would happen for deployments as well. What I mean is that if we have more .esb archives deployed this would also effect the startup time for the XMLBeans version. It would probably do the same for the JAXB version too but it does not register as a hotspot.
      Now, lets take a look a deploying a quickstart and compare the two solutions.
      Again, we start with XMLBeans and the results can be found here.
      Deployment of helloworld quickstart on JBoss AS 4 using XMLBeans:
      org.apache.xmlbeans.impl.values.TypeStore.find_element_user(org.apache.xmlbeans.QNameSet, int)   3,696 µs (0 %) 90 µs   41
      org.apache.xmlbeans.SchemaTypeLoader.parse       2,926 µs (0 %) 1,463 µs        2
      org.jboss.soa.esb.listeners.config.xbeanmodel101.impl.ListenerImpl.getIsGateway  707 µs (0 %)   50 µs   14
      org.apache.xmlbeans.impl.values.TypeStore.find_element_user(javax.xml.namespace.QName, int)      584 µs (0 %)   6 µs    89org.apache.xmlbeans.impl.values.TypeStore.find_attribute_user    498 µs (0 %)   3 µs    137
      Total time = 8411 µs
      Now, lets take a look at the same but this time using JAXB. The results can be found here.
      Deployment of helloworld quickstart on JBoss AS 4 using JAXB:
      javax.xml.bind.Unmarshaller.unmarshal    2,670 µs (0 %) 1,335 µs        2

      Total time = 2670 µs

       

      While using JAXB actually adds to our startup time using the default configured esb services it might not make that much difference when user created .esb archives are deployed. I've not looked into this though but might be worth investigating.
      But for the deployment (after startup that is) there are some improvements to be made when using JAXB.
      Any thoughts on this?
      Regards,
      /Daniel