Peter Roßbachs Tomcat 6 Talk at RheinJUG
25.9.2008 | 2 minutes of reading time
Peter Roßbach, core developer at the Tomcat project, held a talk at RheinJUG in Düsseldorf on Thursday. It was very delightful mixture on Tomcat architecture, best practices, Open Source community as well as current and future developments, rather than a dry technical talk.
Tuning Tomcat Performance
Regarding performance, he mentioned that the main negative factor is to use development mode for production environments. Well have a look at a few parameters and which do affect Tomcat performance.
As of tomcat 6 there is the improved protocol handler available:
1<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" 2 connectionTimeout="20000" />
additionally Java NIO powers a new improved file download option. Servlets just have to set sendfile request parameters and not output any more data. That file will then be pushed by tomcat to the user:
1org.apache.tomcat.sendfile.filename: Canonical filename of the file which will be sent as a String 2 org.apache.tomcat.sendfile.start: Start offset as a Long 3 org.apache.tomcat.sendfile.end: End offset as a Long
production servers should not deploy automatically:
1<Host name="localhost" autoDeploy="false" deployOnStartup="false" deployXML="false">
The Jasper JSP compiler should be tuned as well:
1<servlet> 2 <servlet-name>jsp</servlet-name> 3 <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> 4 <init-param> 5<param-name>development</param-name> 6<param-value>false</param-value> 7 </init-param> 8 <init-param> 9<param-name>genStringAsCharArray</param-name> 10<param-value>true</param-value> 11 </init-param> 12 <init-param> 13<param-name>trimSpaces</param-name> 14<param-value>true</param-value> 15 </init-param> 16</servlet>
Using mod_jk for loadbalancing
As a second main topic of his talk, he presented the module “mod_jk”, which in connection with a Apache Httpd and the Tomcat AJP protocol enables distributing java applications on multiple Tomcat servers.
He explained the different loadbalancing setups and that it might make even sense to user a Tomcat server per application, as this allows better memory management and improves overall high-availibility.
Tomcat Configuration:
1<Connector port="8009" protocol="AJP/1.3"/> 2<Engine name="Catalina" defaultHost="localhost" jvmRoute="node01">
mod_jk Configuration inside Httpd:
1<IfModule !mod_jk.c>
2 LoadModule jk_module "modules/mod_jk.so"
3</IfModule>
4JkShmFile "logs/mod_jk.shm"
5
6JKWorkerProperty worker.list=loadbalancer
7JKWorkerProperty worker.node01.port=8009
8JKWorkerProperty worker.node01.host=localhost
9JKWorkerProperty worker.node01.type=ajp13
10JKWorkerProperty worker.loadbalancer.type=lb
11JKWorkerProperty worker.loadbalancer.connection_pool_minsize=0
12JKWorkerProperty worker.loadbalancer.connect_timeout=30000
13JKWorkerProperty worker.loadbalancer.prepost_timeout=10000
14JKWorkerProperty worker.loadbalancer.balance_workers=node01
15JKWorkerProperty worker.loadbalancer.method=Request
16JKWorkerProperty worker.loadbalancer.retries=2
17JKWorkerProperty worker.loadbalancer.recovery_options=7
18JKMount /myapps* loadbalancer
Further documentation on mod_jk worker can be found here:
http://tomcat.apache.org/connectors-doc/reference/workers.html
In total a very interesting talk, with lots of stuff to learn from, let it be the Tomcat project or the Tomcat architecture, or how Open Source “lives” and what one as developer or architect should consider when developing a Java web application.
More articles
fromFabian Lange
Your job at codecentric?
Jobs
Agile Developer und Consultant (w/d/m)
Alle Standorte
More articles in this subject area
Discover exciting further topics and let the codecentric world inspire you.
Gemeinsam bessere Projekte umsetzen.
Wir helfen deinem Unternehmen.
Du stehst vor einer großen IT-Herausforderung? Wir sorgen für eine maßgeschneiderte Unterstützung. Informiere dich jetzt.
Hilf uns, noch besser zu werden.
Wir sind immer auf der Suche nach neuen Talenten. Auch für dich ist die passende Stelle dabei.
Blog author
Fabian Lange
Do you still have questions? Just send me a message.
Do you still have questions? Just send me a message.