How to tune up the performance of JSP through configuration?
One of old tricks is to precompile all your JSP files. Others can be done by measuring and finding what are the bottlenecks. Usually they are between the application and the database. It's a hard process but may bring quite good performance gains.
One useful tip we've used very often is to Disable Dynamic Reload of JSPs on Production or set it to check only after a large interval of time. On development instances, this is usually set for the server to check for any changes to the JSP on each request.
On Weblogic this is called JSP pageCheckSeconds and setting it to -1 ensures that the server does not check the disk to see if the JSP has changed each time. If set to 0, pages are checked on every request.
Other servers have this too
Glassfish http://docs.sun.com/app/docs/doc/820-4343/abedz?l=ko&a=view
Tomcat http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html
JSP engine optimization
This is to be configured at appserver level. This covers precompilation, trimming whitespace, turning off development-handy stuff (constantly checking for changes in files to hotreload, hotdeploy, etc) and some premature-optimization-like settings as using char[]
instead of String
, etcetera. In case of Tomcat, all details can be found in the Jasper JSP engine HOW-TO.
HTTP connector optimization
There are two HTTP connector settings which can greatly improve performance. Turning on GZIP compression can save up to 70% of network bandwidth and turning on NIO gives room for over 20K concurrent users instead of "only" about 5K before the website starts to slow down or even die. In case of Tomcat, all details can be found in HTTP Connector reference.
YSlow
Get YSlow and try optimizing your website to Grade A. In this blog article you can find more details how to achieve this in case of a JSP/Servlet webapplication.