How does the debugging level (0-99) in Tomcat server.xml affect speed?

The .xml server that controls the launch of the Apache Tomcat servlet container contains a debug attribute for almost every major component. The debugging attribute is more or less detailed depending on the number you give it, zero is the smallest, and 99 is the most verbose. How does the debugging level affect Tomcat speed when serving a large number of users? I believe zero is fast and 99 is relatively slower, but that's true. If no errors occur, does it matter?

+4
source share
2 answers

Extensive registration takes a considerable amount of time. That's why it's so important to put

if (log.isDebugEnabled()) log.debug(bla_bla_bla); 

therefore, I would say that setting your production server to verbosity will seriously affect performance. I assume that this is the production server you are talking about, since you are saying that it should serve a large number of users.

+2
source

Registration is not only responsible for providing you with errors, but also for tracking what is happening. In some cases, the code cannot be run inside the debugger, then registration is your only option.

That is why the output of the journal can be extremely detailed. And I really mean it. I remember once installing loglavel Catalina in TRACE and as a result a file with several megabytes appeared. This was before the server received any hits. It was a huge action movie. Set off in a few seconds.

If you do not need registration for Tomcat, do not activate it on any of its components. Typically, you just want to tinker with the Tomcat log layer if you suspect an error in your setup or in Tomcat itself.

For your own applications, measure the cost of logging using a profiler or just stress testing. Regardless of your results, I would recommend not running the application with a high degree of loglevel in a production environment. My current project drops megabytes per request in the TRACE settings, only about three to four lines on INFO and says nothing about WARNING (if everything goes well :-). I recommend nothing more than the most essential magazine. Your application should really just report startup, shutdown, and crash, and - at most - one line per request.

+2
source

Source: https://habr.com/ru/post/1276926/


All Articles