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.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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:
.handlers = 1catalina.org.apache.juli.FileHandler,
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