The content of this article is about how to optimize the PHP website when it has high concurrency. It has a certain reference value. Now I share it with you. Friends in need can refer to the high concurrency solution case:
When When QPS reaches 2000
Optimization plan: Business separation, distributed storage
1. Traffic optimization
Anti-hotlink processing (removing malicious requests), current limiting, speed limiting , Limit the number of concurrencies
2. Front-end optimization
(1) Reduce HTTP requests [merge css, js, etc.]
(2) Add asynchronous requests (do not merge all data first) Displayed to the user, the user triggers an event before requesting data asynchronously)
(3) Enable browser caching and file compression
(4) CDN acceleration
(5) Establish an independent image server (reduce I/O)
3. Server-side optimization
(1) Page staticization
(2) Concurrent processing
(3) Queue processing
4. Database optimization
(1) Database cache
(2) Sub-database, sub-table, partition
(3) Read-write separation
(4) Load balancing
5.Web server optimization
(1) nginx reverse proxy to achieve load balancing
(2) lvs to achieve load balancing
Related recommendations:
PHP website How to deal with large traffic and high concurrency issues
The above is the detailed content of How to optimize php website when there is high concurrency. For more information, please follow other related articles on the PHP Chinese website!