Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

mysql - Wordpress server analyze

I have a private DigitalOcean server that I use for my own website and some small clients that don't get many visitors to their sites. Each site is a small WordPress installation installed using Ubuntu and Nginx . Lately, the memory and CPU has been spiking at random intervals or when I visit the WordPress dashboards of certain sites and is causing all of the sites to go down, making me need to SSH into the servers to restart mysql to get all of the sites back up again. This has been happening more often as well.

My question is how best to analyze the server and see what the problem is and because is falling and after restarting mysql it does everything perfectly again?

Probably something overloaded the server and it crashes, is there any documentation on how to analyze this. Thanks in advance


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

A few things you could try:

  • analyze web server logs with goaccess -- sometimes there are bots (SEO or other) that could put a high strain on your server (check the "Visitors and hostnames" part for any anomalies)
  • optimize your db tables
  • run mysqltuner to check common optimization issues
  • enable mysql slow log and check for expensive queries

Even if it's a small server you might benefit from using an external cache such as memcached or redis to reduce the load on mysql... they work better with lots of ram, but even if you have some (I would say 32 MB or more) to spare they can be useful. After installing them you need a plugin to enable the external object cache in WordPress, such as Redis Object Cache


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...