Question

High Server Response Time on Droplet-Hosted Website

Hi everyone,

I’m hosting my website on a DigitalOcean droplet (Ubuntu 22.04 with Nginx), and I’ve been noticing high server response times recently. Pages that used to load within 1 second now take 3–5 seconds to respond, even for simple static content.

Here’s my setup:

  • Droplet: 2 GB RAM, 1 vCPU, 50 GB SSD
  • Web server: Nginx
  • Database: MySQL
  • CMS: WordPress with a few lightweight plugins
  • Traffic: ~5,000 daily visitors

The issues I’ve noticed:

  1. TTFB (Time to First Byte) has increased significantly, as reported by tools like GTmetrix and Pingdom.
  2. The server’s CPU and RAM usage seem normal, with no major spikes.
  3. Static files like images and CSS are cached, but the issue persists even with cache enabled.

What I’ve tried so far:

  1. Optimized the database by removing overhead and running OPTIMIZE TABLE.
  2. Increased the PHP memory limit and ensured PHP-FPM is configured properly.
  3. Enabled Gzip compression and browser caching in Nginx.
  4. Checked for malware or unusual traffic patterns but didn’t find anything suspicious.

Questions I have:

  1. Could this be a networking issue specific to DigitalOcean’s data center? How can I test this?
  2. Are there recommended Nginx or MySQL settings to further optimize performance for my droplet size?
  3. Should I consider upgrading my droplet, or is there something I’m overlooking in terms of server configuration?

Any guidance or troubleshooting tips would be greatly appreciated! Thanks in advance!


Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
December 17, 2024

Hi Ben,

It sounds like you’ve already done some great troubleshooting so far!

Regarding the networking issue, this is highly unlikely, but a quick way to test this is to run an mtr from your laptop to the Droplet’s IP address and see if there is any packet loss along the way.

It is usually normal to see some performance degradation as your website grows and your traffic increases but your server resources stay the same. It is a good practice to:

  • Delete any plugins that you do not really need
  • Delete all themes that are not active, even if they are deactivated they could still cause some performance issues and expose security vulnerabilities
  • If you have a security plugin like WordFence for example, it is great for scanning your website, but having it constantly on your site could have a large performance impact as each request is essentially scanned
  • You could use a caching plugin like WP super cache or W3 total cache for example

On the server resource utilization side, you can use top or htop to get some more details on the CPU and RAM utilization in real-time. This will also give you a list of the processes that are consuming most of the resources which would point you in the direction what might the bottleneck be.

On the MySQL side, you could also follow the steps here on how to tweak your MySQL service for better performance and stability based on the resources that you have available on your server:

https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability

You could definitely try adding more resources like RAM and CPU to your Droplet and see if this helps. If you were to only upgrade your RAM and CPU without upgrading your Disk, then you will be able to downgrade your Droplet later on if you think that the extra resources did not help.

On the PHP memory limit, you need to be careful here as if you were to give PHP too much memory it could easily exhaust the available RAM on the server, especially on a server with only 2GB of RAM.

Let me know how it goes!

- Bobby

KFSys
Site Moderator
Site Moderator badge
December 21, 2024

To address the increased server response times and provide specific guidance, we need a bit more information. Here’s how you can proceed to help identify the root cause:

  1. Server Logs: Check your Nginx, PHP-FPM, and MySQL logs for any errors or unusual patterns. These logs can provide valuable clues about potential bottlenecks or misconfigurations.

  2. Database Performance: Monitor your MySQL performance using tools like mysqltuner or phpMyAdmin to identify slow queries or suboptimal settings.

  3. Network Performance: Test the network latency to your droplet from various locations using tools like ping or mtr. This can help identify whether the issue might be related to DigitalOcean’s data center or your specific server.

  4. Page Load Analysis: Use browser developer tools or tools like GTmetrix to pinpoint which part of the page load process is slowing down. For example, is the delay happening before the server responds (TTFB) or during resource loading?

  5. Resource Usage Monitoring: While you mentioned CPU and RAM usage seem normal, tools like htop or netdata can provide deeper insights into I/O, disk usage, or any unexpected background processes consuming resources.

  6. WordPress Debugging: Enable WordPress debugging to log any errors or warnings that might indicate plugin conflicts, theme issues, or other CMS-related problems.

Recommendations to Consider:

  • Caching: Ensure that a full-page caching solution is in place, such as a plugin like WP Super Cache or a reverse proxy like Nginx FastCGI Cache.
  • Database Optimization: Periodic maintenance like optimizing tables and checking for unused data is great, but ensure indexes are properly configured for your queries.
  • Content Delivery Network (CDN): If not already in use, a CDN like Cloudflare can offload some traffic, especially for static files.
  • Server Upgrades: While your current droplet should handle 5,000 daily visitors, if usage spikes or your website’s complexity has increased, an upgrade might be warranted.
  • Review Server Configuration: Fine-tune Nginx and PHP-FPM settings based on your traffic and workload patterns.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.