SJSXP 1.0.1 available from Java.net
The Sun Java Streaming XML Parser (SJSXP) 1.0.1 is now available for download from Java.net. This is our first release since FCS back in April 2006. In his new blog, Joe Wang has already talked about this new release as well as some of the fixes and features in it. SJSXP is the underlying parser used in Glassfish as part of the JAX-WS runtime. I'll elaborate on one of the performance improvements aim at processing small messages at a high transaction rate.
We have nearly double the throughput on small documents by implementing a new buffering allocation strategy in SJSXP. When parsing small documents (say of less than 2K) the time spent setting up the parser before initiaing the parsing process tends to be dominant factor. Typically, when a parser is initialized, it sets up some buffers to be used during the parsing process. Even if these buffers are small, say a few KBs, when hundreds or thoudsans of documents are processed during one second, the amount of memory gargage generated by these buffers is very significant and can easily become the dominant factor. That is, no matter how much you improve the actual parsing process, it will not make any difference given that the VM's time will be mostly dedicated to memory allocation and collection. By implementing a simple buffer allocator that allocates and frees memory chunks, we have nearly duplicated the number of transactions per second in SJSXP. This is evident when analyzing the lastest performance numbers reported by the JAX-WS team. See Kohsuke's blog for more information.
Yes, I know, there isn't any rocket science in these findings, but it is amazing how often programmers overlook the cost of allocating a small buffer. So next time you do that, don't forget to think about the consequences of your decision, especially if your object will be part of the main loop in high transaction system.