Summary of some solutions for the. net Website to cope with the pressure,. net to cope
The Start Year is relatively blank. I will write a blog post and summarize some technical solutions for my work to cope with the website access pressure.
The current pv of your project is about 50 W a day. I have summarized some of my solutions from the frontend to the backend.
I. Front-end page:
1. First, reduce the resource size. You can use a thumbnail to use it. Reference a third-party JavaScript compressed version of js with mini.
2. Use CDN to reduce server access pressure and place images, css, and js files on CDN. Users can obtain resources from the cdn cache far faster than accessing the server. (There are also network relationships, cdn network is fast)
3. js with long time consumption can be loaded after asynchronous requests.
Ii. Server Load balancer:
There are many Load Balancing solutions, no bad money, no bad money. I use nginx Server Load balancer.
Prepare a dedicated nginx server for load balancing and forward it to five business servers. (When the development requires a single debugging, use hosts to point to a single one)
Iii. Server Cache
Because of its distributed architecture, memcached and redis are mainly used for server cache (two servers each configured, one master Service and one slave ). Both memcached and redis have their own. net versions, which are not complex to use.
The specific choice depends on the business requirements. I basically use memcached for 70%, and redis will be used for caching for a long time.
Memcached has poor support for Chinese characters. To store Chinese data, first store the Chinese base64 encoding and perform base64 decoding during reading.
Iv. Database
I mainly use sqlserver and mysql for a few projects. A single SQL server can support a traffic of 50 million. Reduce transactions as much as possible, and the business needs to be supplemented by message queues.
If a large job website does not process the data, it will use other programs to process the data. (modify the redis cache first in response to a high requirement, and then use an asynchronous program to operate the database .)
Logs are recorded during the operation. If the database crashes or the website crashes, you can read the log file to perform data recovery. (Generally, the server will not be suspended for a long time. After more than one day, the server will not be able to survive .. Looking for a solution based on the actual situation)