Website performance optimization

Source: Internet
Author: User

Basic concepts

1, website throughput: tps/transactions per second, qps/queries per second, hps/HTTP requests per second

2, server performance indicators: System load, memory usage, CPU usage, disk usage and network I/O, etc.

Front-End Optimization method

1. Reduce HTTP requests: Reduce HTTP requests by consolidating multiple front-end resources into one implementation to improve performance.

2, set the response header field is a part of the timeliness of the requirement is not high static resources in the front-end browser cache.

3. Enable transport compression. For example, Gzip.

4, the rational layout of the front-end code structure, CSS,HTML,JS code of Shun-search from top to bottom.

5. For some publicly accessible resources, you can reduce the number of cookies in transit by setting up other domain names.

6, the use of CDN distribution, the static resources deployed in the computer room of the major network operators, this way users can be very quickly near the resources.

7. Use a reverse proxy to cache popular content, static resources, or some cached results in a proxy server. By configuring a proxy server, you can implement a proxy server to forward cached resources directly.

Back-End Optimization method

1, the application server implementation stateless, the session information is stored in the cache server cluster, so that each application server can be treated the same. You can scale the throughput of your entire system horizontally by increasing the number of servers.

2, choose a reasonable caching strategy, only cache for the business is not high-demand, and access to large data, select the appropriate cache hit algorithm, reduce the increase in server or server downtime for the application of the impact.

3, the cache defense policy, the predictable but not the existence of the data cache, to prevent malicious attacks on the cache to initiate the request of the resource, resulting in the final request pressure on the database.

4. Use Message Queuing to implement asynchronous processing of Web sites. For some interface calls that take a long time, a producer consumer pattern can be implemented through a message queue, each of which can be either a consumer or a producer. But Message Queuing is also certain, and additional mechanisms need to be added to ensure transactional, such as a table to record the consumption of messages and consumption results to achieve the eventual consistency of the transaction.

5. Reuse of resource fees to reduce time and performance overhead when creating resources, such as using database connection pooling and thread pooling.

6. Improve the logic of code and the data structure of the code, and optimize the algorithm to improve the processing time of the application.

7, hardware on the use of more excellent (fast) hardware.

Summarize

Which of the above-mentioned optimization methods for a large and medium-sized web site, is a very common solution, but the implementation of different business, there will be their own implementation, where the implementation of the method refers to different combinations of solutions and the corresponding technology implementation methods. For example, some sites do not need a front end plus a CDN, some sites do not need to add cache server cluster, some businesses use JMQ to implement Message Queuing, some use Redis cache messages to implement Message Queuing, transactional assurance, or not necessarily through database lock or thread synchronization to achieve, It is also possible to record locks by adding additional storage structures, and locks are just a concept, and we can choose the way in which a programming language comes with a data structure to describe a lock.

Website performance optimization

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.