Most of the developers uses “System.out.println” in the code for debugging, so that they can see the messages easily in the console. This may be handy for debugging, but it will make a huge performance impact on the system if not removed before deployment

The reason is that the application server will have only one output stream and one error stream in the JVM. Hence multiple threads calling the System.out.println() have to be synchronized.

Considering the production system with thousands of users, back end programs, webservices, and scheduled process running parallel in the machine. Calling system.out.println() will potentially block the performance of whole system. Also the application server doesn't redirect the std out to a file, and is lost.

It is always a best practice to remove the System.out.println() /System.err.println() from the code before doing the deployment.

0 comments