Tomcat performance optimization through consolidated log file handlers
By Lukas Stewart
Whether you are a software developer tasked with troubleshooting a live application or a systems administrator performing strident monitoring of your production server, regularly checking the various application and server logs that your infrastructure generates is a critical activity.
Any time an application is monitored, the monitoring itself degrades the performance.
Of course, anyone who has taken even an introductory performance tuning course knows that the Heisenberg uncertainty principle applies just as much to application monitoring as it does to quantum mechanics. That is, any time an application is monitored, the monitoring itself degrades the performance.
Fortunately, in modern computing environments, the task of generating text and writing it to an output stream is a fairly mundane task that doesn't overburden a multi-processor machine with peta-bytes of memory, something that couldn't be said for servers of the past where every moment spent logging robbed running applications of precious clock-cycles and computing power.
But regardless of the power of modern server hardware, a prudent administrator knows that there is never any excuse for wasting resources, and any optimization that improves performance without introducing any peripheral problems is a good one, which is why anyone running a Tomcat server should be interested in eliminating the needless duplication of log file handlers.
Consolidating log file handlers
By default, Tomcat uses two handlers for generating log files. However, this can be changed by opening up the logging.properties file and looking for the following entry:
By simply changing the .handlers entry to use the FileHandler and the FileHandler only, you can consolidate multiple handlers into one and reduce the overhead in writing applications logs:
.handler = 1catalina.org.apache.juli.FileHandler
It is just a simple change, but by consolidating the log file handlers, you reduce the overhead of logging, which minimizes the impact of performance monitoring and subsequently releases otherwise consumed resource to handle the real application load.
Do you have any good tips that will help administrators save time when configuring and optimizing the Tomcat application server?Let us knowabout your favorite tips and tricks.
Tomcat: The Definitive Guide by Jason Brittain
Apache Tomcat 7 Essentials by Tanuj Khare
Java Performance by Charlie Hunt
Java Performance Tuning (2nd Edition) by Jack Shiraz
Java Performance and Scalability by Henry H. Liu
05 May 2013
Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.