The server uses ALIYUN's Ubuntu 64-bit server. Today I encountered a timeout problem for the first time. The nginx error is as follows:
2013/11/28 10:12:36 [error] 23856#0: *67294 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 125.66.112.191, server: joinwee.com, request: "POST /lesson/create/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:8081", host: "joinwee.com", referrer: "http://joinwee.com/lesson/create/"
I searched on Google and couldn’t find a suitable solution. Please give me some advice.
Replenish:
When submitting the form, I used htop
to check and found that the resource usage of the 1-core CPU was 1100% and the load average was 3.0. This is a bit too obvious. The main process still appears. On mysql, both CPU and MEM usage are at full load.
This is still due to the service overload caused by writing data in this form. There is no such situation when accessing and performing other operations.
黄舟2017-05-16 17:30:33
Judging from the htop screenshot you posted, the CPU usage of the python process is not high, but the CPU usage of MySQL is very high. It can be basically judged that MySQL takes up relatively large resources when writing data. If it is convenient, it is recommended to use the iotop tool to check the IO load. In addition, use the top command to check the proportion of user, system, iowait, and idle when the CPU is at 100%.
In addition, you can also check MySQL's slow query to see if there are any time-consuming SQL statements that cause high CPU usage.