Here we talk about the performance optimization of a Web project for a specific scenario. The scenario is: after a web front-end request is sent, it takes a long time to get a complete response. How should we consider this situation? Three aspects: Web front-end layer, application server layer and storage layer. Let's briefly talk about it below.
1. Web front-end performance optimization
1. Optimizing browser access, mainly including: reducing HTTP requests, such as various CSS, js, and images that can be combined when they can be combined; using browser caching; compressing pages, etc.
2. Use CDN to accelerate and cache various static resources.
3. Use a reverse proxy.
2. Application server performance optimization
1. Optimize our code, improve design, etc.
2. Use a distributed cache to store data that has a high read-to-write ratio and rarely changes.
3. If there is no requirement for real-time performance, use asynchronous operations as much as possible, which can be implemented using message queues.
4. Using a cluster, distribute concurrent requests to multiple machines.
3. Storage performance optimization
1. In terms of database, you can consider read-write separation, sub-database sub-table, etc.; on the other hand, create some suitable indexes.
2. Complex queries are implemented with search engines.
3. Use distributed storage, etc.