A talk on performance testing

  1. We first look, why do performance testing:

The gaming industry: the line on a new game features, the goal is a full service gaming community, the result of on-line, has appeared in a server crash, the game features icons slow to load problems, leading players complaining, for game operators have issued a number of awards . Specific loss does not form, function and finish the work published, but also because of accidents resulting in longer delay time

This is not a typical performance testing, performance testing or insufficient cause accidents occur. In the game industry is still relatively good, after all, only the virtual loss of money and the player's passion for the game, but in the traditional industry?

Through this case, we know that, in some extreme scenarios, software / hardware pieces and cause great damage and loss, therefore, we need to conduct performance testing to verify that the software under high pressure, high concurrency, high load the actual work under.

  1. What is the performance test

Performance testing is to simulate extreme scenarios, for hardware / software performance testing to determine its ultimate performance and operational status on the performance limits of the border.

Design performance test scenarios, mainly in the following scenarios:

- Benchmark: Understanding the system resource consumption when standing, the situation such as cpu, io, network bandwidth, network connections. If there is interference, be sure to exclude.

- a single request consecutive tests: 1 tps (Transaction Per Second transaction requests per second) in the continuous request, response time, the server resource consumption, mainly for reference.

- Load testing: increasing the number of concurrent requests, view tps, response time, error rate, server resource consumption, mainly for maximum performance analysis.

- Stress Test: Keep the pressure at the critical point of maximum performance for testing, see the server process in high pressure situations.

- Stability Test: Continuous xx days testing under certain concurrent to see if the server operation to achieve the design requirements

Performance testing process can be simply divided into four stages:

Performance requirements analysis phase

Preparation Phase

The implementation phase

Report and summary stage

Third Step - understand the need to use technology performance testing

Performance testing principle introduced:

Performance testing, the essence is to simulate client requests, the server stress testing high concurrency, high traffic, to verify the server's ability to provide services and to identify bottlenecks point, or proposed to optimize

Question:
how simulate high concurrency, high traffic? How to optimize the performance?
How simulate high concurrency:
- the use of multi-threading technology to simulate high concurrency.
- if a concurrent too high, such as concurrent 10w above, you need to use load balancing and distributed processing technology, jmeter tool supports multiple machines as a load machine.

How high flow simulation:
- stuffing large amounts of data with each request to
how to optimize the performance
then how to enhance performance? We first introduce a parameter a measure of performance criteria: TPS (Transaction Per Second transaction requests per second).
We look at TPS formula:
TPS = Total number of requests / response time average
of the total number of requests: the number of all requests within a time
average response time: average response time of all requests
by this formula, we can know, when the denominator the more hours, the larger the TPS. So to improve performance, we just need to increase the average response time on it. So how to reduce the average response time?
Improve network transmission rate, processing rate inside the server, database processing rate, processing rate of the client, wherein the client and server processing speed optimization strategy essentially the same
performance optimization:

Network transmission rate increases:

1, using optical fiber, the routing table configuration, the number of shortening transmission distance and network router hops.

2, if it is real-time services, you need to configure the cache server, the cache to avoid penetration

Server internal processing rate of increase:

Compute-intensive: the idea is to improve the optimization of CPU utilization, multi-threaded modes of thinking. But the number of threads should not exceed the number of cpu core. Because the number of threads exceeds the number of cores cpu, cpu will slice execution threads over portion, cpu read thread cache will increase the pressure of the computing power decrease

IO-intensive:

- optimization idea is to improve the efficiency of storage, such as SSDs, arrays, distributed technology.

- Due to the IO-intensive, CPU may be waiting for IO operation is complete. So we can use more than CPU core number of threads to access the IO, to improve performance (but if the disk is busy, the thread is only a few more disk queuing in the queue, a method of increasing the number of CPU threads to access the IO for read IO / write operation is not busy, but it takes a long time to address scenarios)

- Note: Because only one internal disk IO operations threading, so to realize concurrent disk, you need to use multiple disks, that is, the disk array

Database processing rate:

IO database and direct interaction, so the increase IO performance, can improve database performance.

Database has its own data structure, data storage and optimization algorithms related queries, can also improve database performance

Index Tuning

Cache Optimization

Database connection optimization

Database query optimization

Sub-table sub-libraries

Distributed Processing
mind is as follows:
Here Insert Picture Description

Performance Monitoring

We have to analyze the data, it is necessary to get the data, you need performance monitoring tools to collect and display data to be analyzed.

So we have to how to monitor it? Here we can to carry out the use of tools has been achieved.

Linux:

You can use the tool sysstat package sar command to monitor CPU, memory operation, IO, network
can use the ps command to view the operation of the thread

JAVA: You can use jstack, jprofile, jstat, jmap, jps tools for viewing, which is native java toolkit for analysis of java stack information

Windows:

Resource monitor may be used to monitor and collect data comes widnows

Database Monitoring:

mysql database has built-in monitoring tools, but charges

You can use free tools to monitor, such as innotop

You can use a powerful integrated tool monitoring capabilities, such as zabbix (also can monitor server)

other:

Front-end performance monitoring: Yslow, Google developer mode -> performance, use windows.performance be customized development

Android Monitoring:

- Netease open source Emmagee,

- Tencent open source GT,

- IFLYTEK of iTest,

- Google's open source Battery

Released two original articles · won praise 0 · Views 121

Guess you like

Origin blog.csdn.net/qq_28163501/article/details/104506060