java - How to stress test the CPU of http service (tomcat)
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-06-28 09:22:50
0
5
1200

Premise: Hello everyone, now I need to stress test a tomcat server to find out where the bottleneck of the application is. However, during the test process, the cpu occupied by the jvm resource has not reached 50%. mysql has been brought down.

Now I want to find out the bottleneck of the application service. When the concurrency is high, the CPU will be too high. How to achieve this?
The method I think of is: create multiple threads at the code level, do not read and write the database, and let the CPU go up. Is it possible? ?
Thank you~~

女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(5)
phpcn_u1582

Generally speaking, the bottleneck of web applications is the database. If the application server (whether it is Tomcat or others) is overloaded, generally speaking, it can be solved by adding a server.

If you want to reduce costs and find out where the application bottlenecks are, there are some tricks to stress testing, such as:

Change the mysql storage engine to blackhole so that the database will not be easily brought down.

洪涛

If the CPU usage is too much, the database connection pool has been used to limit the creation of links. In order to reduce database access, can some rarely updated data be placed in a cache such as Redis, so that there is no need to access the database every time to retrieve the data.

For simple stress testing, I like to use ab in apache server. For complex ones, you can try JMeter. Stress testing makes it easier to analyze and find out where the problem lies.

仅有的幸福

The cpu occupied by jvm resources has not reached 50%, and mysql has been dragged down

This looks like a problem with database operations. For example, SQL needs to be optimized, or caching needs to be added to reduce database operations. Can't see anything to do with Tomcat.

大家讲道理

Mysql is all down. It should not be the bottleneck of tomcat. You need to check whether the sql has been optimized. In addition, enable mysql statistics to check whether there is slow sql, whether there is a full table scan, and whether the index is efficient. In addition, have you used a connection pool to control the concurrency of the database? The concurrency supported by MySQL is related to the number of CPU cores. Generally, slow SQL can easily bring down the database

世界只因有你

General system bottlenecks can basically be solved by increasing the number of servers and optimizing requests. The bigger bottlenecks are basically on the database link. According to what you said, you want to test your request concurrency bottleneck, but if you don’t Connecting to the database for testing is basically ineffective and does not help the real project. The bottleneck obtained is not your real bottleneck

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template