By saeeddarabi
Hi everyone,
Droplet info: 1 GB Memory / 30 GB Disk / NYC3 - Ubuntu 16.04.1 x64
I run a WordPress website and I am getting a spic k in traffic which has caused the CPU to be over 100%. I am getting the 524 and 504 Timeout error for the front and backend.
I can’t get ahold of the person I used to use for server related stuff and I have no idea what I need to do to fix the problem.
I would appreciate any help. Thank you so much in advance.
Saeed
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey @saeeddarabi,
So from your information, there are a couple of things that can be done.
I’ll break the answer into the comments as well as it might make it really long to read and overwhelming.
The answer will be set in the current 3 points:
At the moment your Issues are coming from the fact that you are generating too much traffic for the resources you have.
There are two ways to resolve such situations about
Now, sometimes it doesn’t matter how much you’ll optimize your website, you still need more recourses. Having said that before you go toward that solution, you first need to try the optimization process
First and most important would be to upgrade your Ubuntu server. As you are using Ubuntu 16.04, which is heavily outdated you are using outdated OS, packages, and other tools which can cause worse performance for your application/website, not to mention vulnerability issues.
There are two ways to go about this, either upgrade your Droplet from 16.04 to 22.04 OR create a new 22.04 Droplet and migrate your WordPress over to it.
Since the changes between 16.04 and 22.04 are far too big and there most probably would be issues along the way I usually recommend people to recreate their setup on a new Droplet and migrate the configuration over however upgrading the Droplet is also a possibility.
To upgrade Ubuntu you’ll basically need to run 3 commands.
- sudo apt update
- sudo apt upgrade
- sudo apt dist-upgrade
If you want to be a bit more though you can do something like:
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt dist-upgrade
sudo apt-get check
sudo apt -f install
sudo apt -y clean
sudo apt -y autoclean
sudo apt autoremove
sudo dpkg --configure -a
sudo apt --fix-broken install
but usually, the first 3 commands would do the trick.
Now, before you begin, I’ll recommend to create a Snapshot of your Droplet just to be sure you have everything backed in case of an emergency.
You can see the docs here:
https://docs.digitalocean.com/products/images/snapshots/
Snapshots are on-demand disk images of DigitalOcean Droplets and volumes saved to your account. Use them to create new Droplets and volumes with the same contents.
The other option would be to migrate your application on a newly created Droplet which has Ubuntu 22.04.
The first step is to create and configure your Droplet to be ready for your website. This process can be difficult for people with no experience. As such I’ll recommend using the DigitalOcean market place :
https://marketplace.digitalocean.com/apps/wordpress
There is a WordPress image. This will create a Droplet ready for use exactly for a WordPress website. Follow the steps there and you’ll be good to go.
Now that you have a second upgraded Droplet, it’s time to migrate the data, you can use plugins like:
https://wordpress.org/plugins/all-in-one-wp-migration/
It should move your data all in one go. The final step will be to test everything with a host file and make sure it is working fine and then switch the DNS settings and push your site live from DigitalOcean.
This is the first part
As a comment, I’ll post point number 2 and 3
Hello @saeeddarabi
I’ll recommend you examine the CPU usage on the droplet when the site is busy and check if the load is generated from a certain plugin or extension which is not vital to the website’s functionality.
You can try disabling plugins which appear to cause CPU usage and check if this makes any difference.
If you’re not familiar with monitoring server resources this article will be really useful.
https://www.digitalocean.com/community/tutorials/how-to-monitor-cpu-use-on-digitalocean-droplets
Hope that this helps!
Thank you everyone for your helpful answers.
After readiung your helpful replies, I deciced to resize my dropelt following this https://docs.digitalocean.com/products/droplets/how-to/resize/. And so far it seems all is ok. The site is loading fine now.
I will also upgrade Ubuntu once I figure how to do it safely.
Thank you again for all your help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.