Web site performance is an objective indicator, can be reflected in response time, throughput, concurrency, performance counters and other technical indicators.
1, Performance Test Indicator 1.1 response time
Refers to the time that the application takes to perform an operation, from the time it takes to send the request to the last received response data. The following is a list of common operational response schedules for the system.
Operation
Response time
Open a Web site
A few seconds
Database query a record (indexed)
More than 10 milliseconds
One-time addressing positioning for mechanical disks
4 milliseconds
Read 1M data from mechanical disk order
2 milliseconds
Read 1M data from SSD disk order
0.3 milliseconds
Switching from remote distributed to Redis reading a data
0.5 milliseconds
Read 1M data from memory
More than 10 subtle
Java Program Local method call
A few subtle
Network Transmission 2KB Data
1 subtle
In practice, the response time is usually calculated by mean time.
1.2 Concurrent Number
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, concurrent numbers refer to the number of users who submit requests at the same time.
Number of users of the site System > site online users > number of concurrent users of the site
1.3 Throughput
Refers to the number of system processing in the unit time, reflecting the overall processing capacity of the system. For Web sites, you can use the number of requests/sec or Pages/sec or the number of visitors/days or processing business/hour to measure.
TPS (the number of things per second) is a common measure of throughput. Hedgehog also has 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 Web site 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 to 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, which can be achieved by changing the filename. Enable page compression, text file compression efficiency of up to 80%. CSS is placed on top of the page, and JavaScript is placed at the bottom of the page to reduce cookie transmission. You can consider using a separate domain name to send cookies, and so on. 2.1.2 CDN Acceleration
The nature of the CDN is still a cache, but it is deployed on a server that is closest to the user, and is generally cached as a static resource.
2.1.3 Reverse Proxy
In addition to being able to protect Web site security and load balancing, reverse proxies can also provide caching (dynamic resources).
2.2 Application Server performance optimization
The application server is the server that handles the website business, the website's business code is deployed here, the main optimization means have cache, cluster, asynchronous, etc.
2.2.1 Distributed Cache
Caching is primarily used to store data that is high in reading and writing and rarely changes.
Distributed caching refers to the caching deployment in a cluster of multiple servers, which provides caching services in a clustered way, with two specific architectures, one being the distributed cache that is updated synchronously with the needs of JBoss cache pseudocode, and a distributed cache, which is represented by memcached, and does not communicate with each other.
The distributed caching of Jboss cache holds the same cached data in all servers in the cluster, and when a server has a cached update, it notifies the cluster of other machines and the new cached data. The advantage is that the application can quickly obtain cached data from the local, but when the cluster is large, the cache update information needs to pass to the cluster all machines, the cost can be imagined.
Large Web sites require a large number of cached data, may have TB memory footprint, this time the use of memcached, is a communication architecture, each stored cache data can be different.
2.2.2 Asynchronous Operation
To improve Web site extensibility, you can use Message Queuing to invoke Asynchrony.
2.2.3 Using cluster
In the case of high concurrent access to the site, use load Balancing 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 involves multithreading, resource reuse (object pooling or single example), data structure, and garbage collection.
2.3 Storage Performance Optimization
You can consider using distributed storage, Openfiler, disk arrays, HDFS (Hadoop).
Original link: http://blog.csdn.net/chaofanwei/article/details/27168603