A brief introduction to optimization of system throughput performance

Source: Internet
Author: User
Tags mutex

Asked by friends to optimize the performance of things, today a simple summary:
The general Java system, the overall model is as follows:

Complex systems may have multiple application server tiers, and simpler systems may not have application server
Intuitively, the execution path of a user request is:

Refinement to the internal of each server, the requested execution path is:


For example, a business system, a request, CPU processing time of 20ms, read the database total time-consuming to 80ms, the server is 16 cores, then the system's number of threads:
Number of threads = (20 + 80)/20 * 16 = 80
This is the number of threads that are also counted from the CPU angle.
If the system needs to acquire a mutual exclusion lock.
For example, or the above system, a request, CPU processing time of 10ms, read the database total time-consuming to 80ms, to obtain mutual exclusion locks need 10ms, then, from the point of view of the mutex to calculate the number of threads:
Number of threads = (10 + 80 + 10)/10 * 1 = 10
Set more threads, also waiting for mutexes.
One might say that there is a mutex in a simple Web application. Database connection pool, the connection pool configuration is unreasonable, will also become a system bottleneck.
Here, the task of optimizing the system throughput is simplified to find the system bottleneck. The simplest way is to profile,jprofiler and so on the sharp weapon, hangs to the system to go to the pressure test.
However, sometimes the environment of the business system is very complex, the cost of setting up a pressure test environment is very high. It is the simplest and most effective method to collect online performance data on line without affecting the on-line system. Recommend a I write Profile:simple-profiler, can hang directly to line up profile line code, performance loss is very small.
Java system optimization, to escape the adjustment of GC parameters. There are a lot of tutorials on the web, and there's no more nonsense.
Note: This is only a simplified system model, the specific implementation may have more trick
From the above analysis, you can see that the Web server, Application server, is a queue model, simply, the system throughput optimization is the following queue model of the throughput optimization:
The parameters in the above illustration are as follows (do not know how to enter these symbols in the blog):

The variables in the diagram above are inextricably linked, but finally, the throughput formula for the system is:

That is: system throughput = System usage * Number of system threads/request Business processing time
In order to prevent the system request peak, the system utilization rate is generally below 70%, then the optimization has only two paths to go:
1. Increase the number of processing threads--> not as much as possible.
2, reduce business processing time
Business processing time is business-related and is not discussed.
The choice of number of threads is also a chapter to follow:
Number of threads = (total thread time/bottleneck resource time) * Thread parallel number of bottleneck resource



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.