Improve JSP Web Application Performance in Tomcat

02-09-2015

To improve performance a JSP application running on Tomcat server, we have to change some configurations in Tomcat.

1. Disable auto deploy feature by setting false in conf/server.xml file in Tomcat location:

 <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="false">

2. Change jsp servlet configuration settings located in conf/web.xml file in Tomcat location:

<servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
        <param-name>fork</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>xpoweredBy</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>development</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>reloading</param-name>
        <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
</servlet>

As stated in line 13, there is an option named as development. Normally this param is not found in default web.xml file, so we add this parameter by setting its value to false.

Most important part is reloading parameter in line 17. When this parameter's value is set to false, Tomcat will not check any changes in a jsp page and not recompile the pages.

© 2019 All rights reserved. Codesenior.COM