Analysis of neutral performance tuning process in software testing
Source: Internet
Author: User
Analysis of the Process of neutral performance tuning in software testing-Linux general technology-Linux programming and kernel information. The following is a detailed description. Performance Tuning is undoubtedly a huge topic and a very important part of many projects. It is well known that performance tuning is difficult. After all, performance tuning covers too many areas, in this article, let's take a look at the process of Performance Tuning, a huge project, and some common practices in these processes.
Deterministic optimization goals
Performance Tuning: First of all, we need to determine the target of Performance Tuning. If the current application has already met the requirements, there is no need to perform performance tuning, after all, without going through a system process, you cannot determine whether your performance adjustments have actually optimized the performance or caused other problems in the application, therefore, determining the performance target is very important. This is usually defined when defining the performance target:
1. Maximum concurrency
2. Quality of Service
The quality of service, in terms of software systems, is mainly manifested in the request error rate and system load.
3. Maximum response time
The maximum response time that any request can afford.
4. TPS
The maximum number of transactions to be supported per second. The most typical indicator is: "A page must support up to 7000 accesses per second ".
For example, a web system must define the following goals:
Concurrency goal: support a maximum of 200 concurrency;
QoS: the error rate must be controlled in one thousandth, and the system load can only reach 10;
TPS: Processes 7000 requests per second;
Maximum response time: the maximum allowed response time is 5 seconds.
The average response time of a request is not defined in the Performance Tuning benchmark, because to meet the TPS requirement, the response time must reach a level, in addition, the response time degrades with high concurrency.
Of course, you can also set performance indicators to more details, such as how much the TPS of a method needs to be reached at 100 concurrency.
After determining the performance target, it is important to measure the system performance.
Measure System Performance
For a new system, it is necessary to evaluate the growth of the data volume during its formal operation. For a running system, you need to obtain the system running data (such as the peak concurrency, system response speed, system load, network traffic, and the percentage of each type of requests in the total) based on monitoring).
For a new system, it is better to evaluate the specific performance, because the system is usually relatively simple at this time, and the growth of data volume cannot be overnight, therefore, you can evaluate the formal running performance in the test environment according to a normal method.
For a running system, it is more troublesome, because it is generally impossible to simulate a formal running environment in the test environment, therefore, it is usually necessary to take some simulated or more stressful methods to evaluate the system performance as accurately as possible.
The following methods are usually used to test system performance:
1. unit test;
You can use unit tests to test the performance of a request;
2. Stress Testing;
Stress Testing is undoubtedly the most common way to measure system performance. It tests the system based on defined performance objectives to determine whether the system meets performance requirements, at the same time, you can analyze the System Bottleneck Based on the stress test results, and then perform corresponding optimization. There are still a lot of tools that can be used for stress testing, such as loadrunner and jmeter, however, the stress testing topic is too big. I will not talk about it here, but I don't know much about it.
Analyze System performance bottlenecks
Based on the results of measuring system performance, most of them can analyze the bottleneck of the system performance. At the same time, they can be further determined by combining jvm stacks, jprofiler, and system logs, in addition, you can also learn whether the developer has adopted an unsuitable data structure based on the experience of performance tuning personnel.
Here is an example of thread analysis:
Use the kill-3 pid to obtain the current jvm thread stack information. Pay special attention to the threads such as wait for monitor. This thread refers to the thread waiting for the lock, wait a minute or two and then kill-3 pid again to check the changes in the threads of the wait for monitor, this is very important for the analysis of whether there is unreasonable competition for excessive locks in the analysis thread.
This step is undoubtedly the most difficult step in the performance tuning process. The analysis of the system performance bottleneck can only be based on the actual example. We will extract one or two examples to explain the problem.
Performance Tuning
After analyzing the bottleneck of the system performance, this step is actually better. Of course, it should be based on a good understanding of both hardware and software, here are some common performance tuning methods, most of which are copied or google. I don't have much experience in this field. I hope you can give more advice.
Redhat Linux Kernel
The Redhat Linux kernel version is upgraded to 2.6, and there are many differences between 2.6 and 2.4, such as epoll support and NPTL adoption. epoll support is also very important for java, in the case of high concurrency, there is a big difference in whether nio uses epoll. The adoption of NPTL is extremely important for multithreaded programs.
In addition, you need to pay attention to the File Handles, network buffer, MTU, and Memory Page size in linux.
JVM
There are many articles on JVM optimization. You need to understand the following articles:-Xms/-Xmx, parallel GC,-XX: MaxPermSize/-XX: MaxNewSize,-XX: threadStackSize and nio use epoll.
There are a lot of performance tuning methods for simple columns, for example, you can simply increase the CPU, buy a faster hard disk, increase the memory, increase the network bandwidth, and other hardware-based methods, such as database optimization and Application Server optimization.
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.