1

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

SMor
  • 2,830
  • 4
  • 11
  • 14
mare96m
  • 29
  • 5
  • 1
    Additional information request. From your primary website and one of your WordPress installations. WordPress smalls on a 'shared' hosting plan? RAM size, # cores, any SSD or NVME devices on MySQL Host server? Post on pastebin.com and share the links. From your SSH login root, Text results of: B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; E) STATUS; G) SHOW ENGINE INNODB STATUS; H) SELECT name, count FROM information_schema.innodb_metrics ORDER BY name; for server workload tuning analysis to provide suggestions. – Wilson Hauck Jan 06 '21 at 15:29
  • mare96m Would you have time to post the requested information in the next month? Would like to try to assist with making your instance more reliable. – Wilson Hauck Jan 28 '21 at 18:09

2 Answers2

1

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

felipelavinz
  • 549
  • 3
  • 6
0

WP has some poor indexes on the postmeta. Improving them is likely to improve performance:

http://mysql.rjweb.org/doc.php/index_cookbook_mysql#speeding_up_wp_postmeta

Rick James
  • 135,179
  • 13
  • 127
  • 222