OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML Parser in Servlet Performance Problem


I'm experiencing a serious performance problem when parsing XML from a
ServletInputStream in my doPost() handling.

My input data is in the form of a very shallow xml document which looks
  <!-- 1000's of these -->
  <Term>kitty litter</Term>

A simple SAX parse of this data takes anywhere from 15 to 100 times
longer if it is done in a servlet, rather than in a Java application
which is reading the data from a file. I have tried reading the data
into a string, and using a StringBufferInputStream instead, with no
change. I have tried having the servlet read the data into a file first,
and then using a FileInputStream, with no change. The problem is not in
reading the input, but in doing the parsing. (There is also a small hit
for instantiating the parser.)

I have tried the following combinations:
ServletEngine: iPlanet, Tomcat, JRun
Parser: Xerces, JaxP, xp, Aelfred
OS: Solaris, Win2000
the best combination is Tomcat + JaxP, the worst is Xerces + JRun.

I have tried capturing the system time at each call to startElement() in
a SAX DocumentHandler, and I see that the behavior is nearly linear (or
linearly bad), with longer documents taking very slightly longer per

This is killing me. Help.