Lock in Java

In the previous post (Synchronized vs ReentrantLock in Java) ,  we have discussed the difference between synchronized and ReentrantLock. The keyword synchronized can be widely used in many multi-threaded environments. However, there are some drawbacks when using synchronized. The use of keyword synchronized provides access to the implicit monitor lock associated with every object, but forces all lock acquisition and release to occur in a block-structured way: when multiple locks are acquired they must be released in the opposite order, and all locks must be released in the same lexical scope in which they were acquired. In short, when the keyword synchronized locks a block, and a thread is in the block, other threads have to wait and will be blocked until that thread exits the block. It will slow down the performance. In some situations, it may leads to a deadlock. Continue reading

How to Optimize Tomcat Performance

The default Tomcat configuration looks powerful and hassle-free to the 1st time users. However, it is not customized for the real work where high server load can be expected. Therefore, it is important to optimize Tomcat performance by setting customization and system tuning.

The post will describe how to optimize Tomcat performance. Continue reading