0

So, I have a Wordpress droplet in Digitalocean with 4 shared vcpu and 8gb of ram. Everything was working really fine until I get about 400 simultaneous access in the website, then it gets REALLY SLOW. But my ram and cpu are like 40%.

Now that I'm posting this question, that there's 20, 40 people online it goes well. But when I have about 400 people, the website loads really slow - but memory and CPU using 40%.

Does anyone knows what could it be and how can I solve it?

Can it be a problem with my mysql settings? Or anything else?

My website URL is: https://aulas.minhasplantas.com.br/

Here's my terminal when I run top:

enter image description here

And here iotop

enter image description here

4
  • Please share your website link, without a link we can't check anything. Commented Jul 29, 2020 at 7:42
  • Do you have anything that might act as a lock? e.g. all visits write something to do the database, and they all lock the whole table whilst they're writing that, so writing to that one table is a bottleneck for all users? That wouldn't have to be the database, e.g. it could be a file, but I'd guess in WordPress it would most likely be the database. Either way I'd look at the database load and locks.
    – Rup
    Commented Jul 29, 2020 at 7:59
  • Additional information request. 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; AND Optional very helpful information, if available includes - htop OR top for most active apps, ulimit -a for a Linux/Unix list of limits, iostat -xm 5 3 for IOPS by device and core/cpu count, for server workload tuning analysis to provide suggestions. Commented Aug 13, 2020 at 2:10
  • @Guilherme Still taking forever? Post the additional information requested on Aug 13 at 2:10 for suggestions to improve performance, please. Commented Nov 17, 2020 at 20:46

2 Answers 2

0

(This is an opinionated and subjective answer as your question involves many factors and doesn't include detailed information on the scenario)

You may be getting to the point where you have enough volume that you need more professional server optimisation, or you need to get stuck into more advanced server administration.

If you're not CPU or RAM bound then you're disk bound - probably MySQL disk access, but could be other things. A process doesn't have high usage if it's waiting for the disk. You can keep scaling your CPU and RAM up but that won't make the disk go faster so it won't make any difference, so CPU/RAM percentage utilisation will go down without the server speeding up. Check out answers like this for diagnosing beyond CPU and RAM, but note that it's probably MySQL and you should look at that first.

Quick wins in this situation:

  • Because 90%* of Wordpress speed problems are related to big or poorly written database queries you need to look at the database first
  • Use Query Monitor to try to understand if you have specific queries that are generating your load. Delays shown here will obviously be more prevalent and noticeable when your site is under load.
  • In the big picture, it's a reasonably easy job and will give you performance and manageability gains to move MySQL to a separate server. This will let you scale MySQL independently from apache/php. This is probably what you should do first
  • Try to speed up your disk access with easy wins, e.g. is your disk SSD?
  • If it's not MySQL then maybe you have a plugin or other code that's doing some huge disk oeprations and you need to optimise it somehow.

Slow wins

Things which take a bit more time but will get you better at server admin:

  • Get more familiar with htop and tools like iotop to see what's going on on your server.
  • Assuming problem is in MySQL, figure out how to turn on the slow query log so you can get feedback and see again in the future where the bottlenecks are when things get slow.
  • Yes there are a ton of settings to optimise in MySQL. Once you know a bit more about what's going on (e.g. rule out really bad queries you might be able to fix) then post in a place with more specific MySQL expertise for help
  • When you know a bit more post about what's happening in e.g. serverfault where you'll get more specific optimisation advice
-1

I had the same issue where wordpress site was extremely slow. It turns out disabling the DigitalOcean firewall in front of the Droplet had a significantly positive impact.

After this I enabled fpm and http2 for apache2

sudo apt-get install php-fpm -y
sudo a2enconf php8.1-fpm
sudo a2enmod http2
a2enmod proxy_fcgi
systemctl restart apache2

And then I added a caching plugin on wordpress.

But the main issue was the firewall. Beware to replace any rules you wanted via a host-based firewall like iptables.

1
  • If the firewall isn't running on your droplet - i.e. it's an external service, which I think it is, then it shouldn't make any difference. If it does then you should get DigitalOcean support to fix it.
    – Rup
    Commented Sep 7, 2023 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.