Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if the application is suspended due to high concurrency of System.out.println?

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you what to do when the application is suspended under the high concurrency of System.out.println. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Today, during the sequence number stress test, we call the genSeqId method to obtain the sequence number. There are 16 pressure test machines with 100 concurrency. It is found that no matter how the pressure test is done, when the call volume reaches about 140w, the ops of this method directly falls to 0. The figure is as follows:

As you can see from the picture above, the whole ops is falling off a cliff.

At that time, I thought about it and could not solve it. Later, after commenting out the System.out.println in the code, I conducted a stress test and found that it returned to normal:

As can be seen in the above picture, after the pressure reached 100 million, the pressure test was stopped because no problems were found.

Later, I looked through the System.out.println source code and found that it is not suitable for printing under high concurrency, because it uses a large number of Synchronized to synchronize, which leads to the need for synchronous waiting between the two requests.

The above content is what to do if the application is suspended under the high concurrency of System.out.println. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report