Friday, January 07, 2005
Tomcat JSP Precompilation is SLOW!!
Here at Rojo we have recently started precompiling all of our JSPs to improve both the speed and reliability of our system on production servers. We have about 200 JSP files, which is a large web app but not necessarily gargantuan. The entire JSP compilation process, using Ant and the jasper2 ant task, takes about 30 minutes! This is far too long. I mean, there are systems that are doing more than just compiling text, such as advanced 3D graphics and speech recognition, that are far faster than Tomcat's JSP compilation.
I've been working on solving this problem, but to no avail, which is why I'm posting this to see if there is a solution in the blogosphere. Here's what I've done so far:
I've been working on solving this problem, but to no avail, which is why I'm posting this to see if there is a solution in the blogosphere. Here's what I've done so far:
- Switched from JspC to Eclipse's JDT compiler by moving from Tomcat 5.0 to Tomcat 5.5.4, which replaces JspC with JDT. This resulted in no real speed improvement but JDTool is less buggy, which is nice.
- Thinking that maybe the JSP precompilation process was IO bound, I setup a 400 MB ram disk on Linux, moved our entire source tree onto that, and setup the JSP precompilation process to write into the ram disk during its operation. This resulted in no real performance improvement.
- I configured the JSP compiling process to use Jikes as its compiler, but unfortunately Jikes produced a long string of errors when attempting to compile our source code. Jikes might improve the performance, but I was not able to find out because of the difference in compilation between Jikes and the Sun JDK.
- I attached JProfiler to a running JSP precompilation process to see if there are any significant hotspots. I was expecting to find a single method that took a majority of time, such as 70% of the time was spent in a single method, due to an unoptimized data structure or tight loop; if I found this I would then be able to fix it. Unfortunately, most of the time was spent amongst several methods; there was one method that consumed 20% of the time, but spending the time optimizing and only getting a 20% improvement was not enough for me; I need more bang for the buck since engineering time is tight here. The results might be useful for Tomcat JSP developers, so I've generated some HTML reports from JProfiler: Hot Spots, Invocation Tree, Method Graph, CPU Statistics
Subscribe to Posts [Atom]