5 site architecture elements - Performance

Copyright: Complimentary more micro-business marketing courses, please pay attention to the public No. [shop]! https://blog.csdn.net/gzw1623231307/article/details/56475421

5 site architecture elements - Performance

  1. performance
  2. Availability
  3. Flexibility
  4. Expansibility
  5. safety

The most intuitive standard for website performance evaluation is: fast unhappy when a personal visit? ? 2 people unhappy when fast access? ? 10,000 people simultaneously accessing fast unhappy? ? . But technical personnel, need to focus on more detailed metrics: response time, concurrency, throughput; memory, CPU, IO, bandwidth, and so on.

When only one or two users to access the site, the page will open soon, a 200 user concurrent access, although the rate of decline, but still can be accepted by users, then the throughput website also go up. When a twenty thousand user system load increases, the gradual depletion of resources, but decreased throughput, response time more slowly. At this slow system where bottlenecks where? Not enough memory? CPU busy? High IO load? Bandwidth is not enough, and so on?

Response time

User successfully emerge from a URL to click on the page, you may experience a lot of links, each link has its own processing response time, such as:

  • DNS resolution time domain
  • The number of hops each time the network node transfusion
  • Reverse proxy, the front end load balancing server processing time
  • Distributed cache data transfer time
  • CPU scheduling latency and processing time
  • Memory data exchange time
  • Database lookup and transmission time
  • Addressing disk, IO time
  • Page rendering time
  • and many more……

Some aspects of the processing time, as the appearance of small, without adding gaze, but at this time if a large amount of data needs to be considered a single deal with it? Is not it also may lead to these aspects of the response time to increase it?

Concurrent

A real user opens a Web site, could bring more than two concurrent user number of pressure to the site because the browser uses multithreading to download, but also concurrent under the same domain name is connected as a control (modifiable), depending on each browser, which defaults concurrent connections between (2-8).

Throughput

Throughput measures are: QPS (requests / s), TPS (service number / s).

counter

Including memory, CPU, IO, network traffic, OS load. These are all necessary monitoring information system. Once an alarm indicator exceeds a preset threshold.

Performance Testing

Performance testing is before the on-line site for an effective way to detect whether or not the intended target site performance is achieved. Testing collected during the performance index value, the analysis bottleneck.

  1. Performance Testing : Website daily performance in the case during operation.
  2. Load testing : continuous pressure to get the optimum operating point of the site.
  3. Stress Test : pressurized system to system crashes to get the maximum pressure value.
  4. Stability testing : specific hardware and software, the network service functions nonuniform pressure at different points of time.

Performance Optimization

  1. Web front-end performance optimization.
  2. Application server performance optimization.
  3. Storage server performance optimization.
  4. Code optimization.

Front-end optimization

  • Reduce the number of http requests
    merger CSS, JS, background images, reducing the number of requests.

  • Use the browser cache
    static resource files can be cached in multiple aspects: browser, CDN, reverse proxy server, and so on. For the control of the expiration time, you can see the following three items of information at http response header:
    Last modified : Last-Modified: Mon, 23 Mar 2015 18:32:41 GMT
    expired absolute time : Expires: Thu, 17 Apr 2025 02 : 55: 56 GMT
    expired relative time : Cache-Control: max-age = 315360000
    where time is relative to the difference in time to solve the server and client matter of time.

  • Enable GZIP compression
    enabled GZIP compression reduces the amount of data transmitted over the network, text files compression ratio up to 80%. That is 100kb file, the amount of data in compressed transmission network only 20kb.

  • Cookie reduction
    browser Cookie size (4K) under a single domain, the number (20-50) are limited. Every HTTP request contains the Cookie header information in the domain name. Cookie too will increase the amount of data transferred.

  • Domain resources using different segmentation
    browser concurrent connections under a single domain is limited (2-8), the static pictures and other file access by a process dividing two domains, is increased concurrent browser request processing capability. Speed up browser rendering speed to some extent, but not too much, generally 2-4 to maintain domain names on it.

  • CDN
    content distribution network, in essence, is a cache, it can be pictures, documents, CSS, JS, static html and other cache at the time closest to the user's network operator's room, users access the resource, DNS domain name CName (alias) to the CDN, thereby reducing the routing hops the request, returns a response to the shortest path. Reduce response time but also reduce the pressure of the back-end server.

  • The reverse proxy
    also can be set up in front of caching server load in the seven. All requests have to go through it, so between the user and the RS established a safety barrier.

Back-end optimization

  • Distributed cache
    site performance optimization first law: priority to use caching to optimize performance. Eight law: 80% 20% falls on the access data, the cache may be: part or whole pages html, complex calculations, data collection, a single data line. It is noted that the cached data must be: hot data, read times greater than the number of modification.

  • Asynchronous operation
    using the asynchronous message queue of the call, that is able to do things late late do, such as: e-mail after a successful order, e-mail of this operation will be asynchronous technology. Asynchronous operation clipping method is effective, in response to the user data is written immediately after the message queue.

  • Cluster
    a horse strength is no match for another big two horses, three horses, and one-horse dead, your car will not walk (single point), at the site where high concurrency scenarios, using load balancing to build multiple servers for a cluster of common support is necessary. Pressure can be assessed concurrent requests.

Storage Optimization

  • Mechanical hard disk with SSD
    maximum speed of 100M also up and down. Where speed may be required by some scenes, suitably used in place of a mechanical hard disk SSD. It may also be used to improve disk RAID set concurrent read and write capability.
    RAID0: concurrent fast, a data sub-parts of N, N disks simultaneously written, a bad disk, all the bad data.
    RAID1: A data simultaneously write and two disks, write one, a backup, redundant.
    RAID10: two disk partition, data is simultaneously written on two disks

  • Distributed File System

Code optimization

Application software configuration optimization

Guess you like

Origin blog.csdn.net/gzw1623231307/article/details/56475421