XB profiling during the AS start-up
aloubyansky Sep 16, 2009 9:58 AMTo get an idea of what's taking time in XB during the AS start-up, I added simple time checks for three things:
- creation of unmarshaller instances (parsers)
- unmarshalling (parsing xml + assembling the Java graph)
- schema binding (parsing of JBossXB/JAXB annotations)
I started the default AS configuration 10 times and here are the average time results.
AS start-up: 26385 ms
XB total: 2460 ms or ~9% of AS start-up
unmarshallers (95 instances): 90 ms or ~4% of XB total
unmarshalling (72 files): 1331 ms or ~54% of XB total
binding (17 schemas): 912 ms or ~37% of XB total
First thing I tried was schema binding creation by means of serialization/deserialization of schema bindings instead of re-building them on every start-up from Java annotations (that was a long awaiting feature request). Deserialization of schema bindings (with the standard Java serialization) appears to be around 6.5 times slower then building schema bindings from annotations. Classloading during deserialization takes around 140ms which is ~3% of total derserialization time. So, the idea of serializing/deserializing schema bindings with standard Java serialization is not looking good.
Then I looked into reading annotations (class-, property-, package-level) during schema binding construction. For all the schemas during AS start-up the total average time is 127 ms which is ~14% of the binding time and ~5% of the XB total time. So, this looks good and looking for another source to get this information from doesn't make sense.
What's left for the optimization of schema binding creation is the way the data from annotations is processed. The total average time to process the data from annotations is 785 ms, which is ~86% of total binding time and ~32% of total XB time.
So, at the end the main areas for optimizations in XB during AS start-up are:
- unmarshalling (xml parsing + assembling the Java graph) which takes 1331 ms or ~54% of the XB total time
- processing annotation data during schema binding creation which takes 785 ms or ~32% of the XB total time
But before I proceed with the annotation processing optimization I'm gonna get some more details for the unmarshalling time, i.e. pure XML parsing (which is xerces) vs the rest of the XB unmarshalling code.