Best Practice 4 Minimize Synchronization in Servlets

zhaozj2021-02-17  47

Best Practice 4 Minimize Synchronization in Servlets

Servlets is multithreaded. The application based on servlets has to handle this content. However, if most of the code in the code is synchronous, the utility of the application will become a single thread, and the system's throughput will be reduced.

The processing primary code in the synchronous code in Figure 4A protects the instance variable of a servlet, moves LOCK to the servlet instance variable in Figure 4b and is outside the dangerous code path. The performance comparison is given in Figure 4c.

转载请注明原文地址:https://www.9cbs.com/read-29699.html

New Post(0)