The other day I needed to put together a CRUD-type web app. In it, I knew I was going to do a bunch of XML processing, and since I only had about a week and a half to put it together, I decided to just use JSPs and the JSTL.

I happened to have Sun Java System Web Server 6.1 already installed on one of my development boxes, so I just went ahead and started developing on it. I made heavy use of the XML processing tags in JSTL to read, iterate and transform a bunch of remote XML files. Everything went together very smoothly.

Then came time to migrate it to a more "production" server, which happened to be running Sun Java System Web Server 7.0, and things went a little awry. The application took much longer to process all the XML files. I distilled things down to a test case where processing a 400K XML file went from about 50 milliseconds on SJSWS 6.1 to about 1/2 second with SJSWS 7.0.

WTF!

I knew JSTL bumped up from version 1.0 in WS 6.1 to version 1.1 in WS 7. A seemingly minor change, based on version numbers at least.

So next I loaded the application up into Tomcat 5.5.x, just to verify it wasn't a problem with WS 7.0, which was true. The application performed just as poorly in Tomcat as WS 7. Both use JSTL 1.1.

Well, after some digging, I found the culprit. It ends up being a problem with JSTL 1.1, and is logged as Bug 27717 over at ASF. Essentially, the back end XML processing APIs were replaced between JSTL 1.0 and 1.1, from Jaxen/Saxpath to Xalan/Xerces. That's actually a pretty big difference. You can read the bug to understand it more.

Ok, with the problem identified, I still didn't have a solution, and I wanted to use WS 7. So I thought I'd attempt to install JSTL 1.0 in WS 7. Probably not a supported configuration, but one that might just work for now.

And this, in fact, worked just great! Pretty easy to do to. After downloading and extracting JSTL 1.0. I created a lib-ext folder at the base directory of where I installed WS 7. Then copied jaxen-full.jar, saxpath.jar, standard.jar, jstl.jar into lib-ext/

Then I logged into the WS 7 Administration Console and navigated to Configurations -> instance -> Java and added the following in the Classpath Prefix

${WS_INSTALL_ROOT}/lib-ext/jaxen-full.jar
${WS_INSTALL_ROOT}/lib-ext/saxpath.jar
${WS_INSTALL_ROOT}/lib-ext/standard.jar
${WS_INSTALL_ROOT}/lib-ext/jstl.jar

Then just deployed the configuration, and voila! Instant performance boost for my application.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by mock