A few days ago my colleague asked me to help him figure out why his Wordpress website was running so slow. Everything seemed fine, the CPU was not busy, the memory was not used much. It was not the network issue because its ping time was very fast. The MySQL database was not slow either. So it was hard for me to debug.
The site returned 504 error initially, but it sometimes could load the page (after a long wait). I checked the Nginx error log and found that the upstream connection was not responded. So it must be something wrong with the PHP code.
I tried many ways which I found on the internet but no success. Most of them were about increasing the timeout or the execution time. By doing that, the page could load but it was still super slow (it loaded in > 1min).
When I sat quietly for a while to think, I realized that plugins could be the issue. There could not be any reason a Wordpress could be that slow unless …[Read more]