views:

36

answers:

3

How to tune up the performance of JSP through configuration?

+1  A: 

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.

Boris Pavlović
+1. Precompilation (or maybe disabling file modification checks after the initial compilation) is probably the only thing you can try. "Usually they are between the application and the database". That means: nothing that a simple JSP configuration option could fix.
Thilo
JSPs are all compiled the first time they are accessed, and if you use production settings (i.e. not scanning for changes), that's the compiled jsp does not change.
Bozho
A: 

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

WebSphere http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rweb_jspreloading.html

Tomcat http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html

JoseK
+1  A: 

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.

BalusC
and PageSpeed ;)
Bozho