http://blog.csdn.net/chaofanwei/article/details/27168603
Website performance is an objective indicator, can concretely reflect the response time, throughput, concurrency number, performance counters and other technical indicators.
1. Performance Test Indicator 1.1 response time
The time required for an application to perform an operation, which is the time required to receive the response data from the request to the last. The operating response schedules commonly used by the system are listed below.
Operation |
Response time |
Open a Web site |
A few seconds |
Database query a record (with index) |
More than 10 ms |
One-time address positioning of mechanical disk |
4 ms |
Read 1M data from a mechanical disk sequence |
2 ms |
Read 1M data from SSD disk sequence |
0.3 ms |
From remote distribution to Redis to read one data |
0.5 ms |
Read 1M data from memory |
More than 10 subtlety |
Java Program Local method call |
A few subtle |
Network Transmission of 2KB data |
1 subtlety |
In practice, the calculated response time is usually averaged over the average time.
1.2 Concurrent numbers
Refers to the number of requests that the system can process simultaneously, and this number also reflects the load performance of the system. For a Web site, the number of concurrent users refers to the user who submits the request at the same time.
website System users > website number of users > website concurrent users
1.3 Throughput
Refers to the number of requests processed by the system within a unit of time, reflecting the overall processing capacity of the system. For Web sites, you can measure the number of requests/sec or Pages/sec or number of visitors/days or process business hours.
TPS (number of things per second) is a common measure of throughput. Hedgehogs also have HPS (number of HTTP requests per second), QPS (number of queries per second).
1.4 Performance Counters
Refers to some of the operating system's data metrics such as system load, CPU usage, memory usage, disk usage, and so on.
2. Performance optimization Strategy
According to the website layered architecture, can be divided into web front-end performance optimization, Application server performance optimization, Storage server performance optimization.
2.1 Web front-end Optimization 2.1.1 Browser access optimization
- Reduce the number of HTTP requests, mainly by merging Css,javascript, pictures.
- Use browser-side caching. At some point, static resource file writing needs to be applied to the client browser in a timely manner, in which case it can be implemented by changing the file name.
- With page compression enabled, the compression efficiency of text files is up to 80%.
- CSS is placed on top of the page, JavaScript is placed at the bottom of the page
- Reduce cookie transmission. Consider using a separate domain name to send cookies.
2.1.2 CDN Acceleration
The nature of the CDN is still a cache, just deployed on the server closest to the user, generally caching static resources.
2.1.3 Reverse Proxy
In addition to being able to protect the security of the site and the role of load balancing, the reverse proxy can also provide caching effects (dynamic resources).
2.2 Application Server Performance optimizations
The application server is the server that handles the website business, the business code of the website is deployed here, the main optimization means are cache, cluster, asynchronous and so on.
2.2.1 Distributed Cache
The cache is primarily used to store data that reads and writes very high and rarely changes.
Distributed cache refers to the cache deployed in a cluster of multiple servers to provide caching services in a clustered manner, with two specific architectures, one is to update the synchronized distributed cache with the needs of the JBoss cache pseudo-code, one of which is represented by memcached Distributed caches that do not communicate with each other .
The distributed cache of the Jboss cache stores the same cached data in all servers in the cluster, and when a server has a cache update, it notifies the other machines in the cluster of the new cache data. The advantage is that the application can quickly get cached data locally, but when the cluster size is large, the cache update information needs to pass to all the machines in the cluster, the cost is conceivable.
Large Web sites need to cache data is generally large, there may be terabytes of memory consumption, this time the use of memcached, is a non-communication architecture, each stored cache data can be different.
2.2.2 Asynchronous operations
To improve the extensibility of your Web site, you can use Message Queuing to make calls asynchronous.
2.2.3 using clusters
In the case of high concurrent access to the site, use load balancing technology to build a cluster of multiple servers for an application, distributing concurrent access requests to multiple servers for processing.
2.2.4 Code optimization
Code optimization mainly involves multithreading, resource reuse (object pooling or singleton), data structure, and garbage collection.
2.3 Storage Performance Optimization
Consider using distributed storage, Openfiler, disk array, HDFS (Hadoop).
Large Web site technology Architecture (iv)--high-performance architecture of the website (RPM)