How to reduce the server response time? Taking too long to respond!

February 25, 2017 6.5k views
Apache LAMP Stack WordPress Server Optimization CentOS

Hello, its been more than a week now since I have migrated my blog from shared hosting to the DigitalOcean's $20/ month plan.
I was expecting better performance, but then I ran some tests and the results were not so impressive.
The response time is too much. Even on the shared hosting the load time of the blog was around 2.5 seconds and 3 sec at max, while now, it is more than 4.5 or 5 seconds. As of now, the response time of the blog is around 1 to 1.6 seconds and this is not happening for only the homepage but for all the pages of the blog.

I don't have much knowledge about server optimization, but totally aware of the fact that my server needs some tuning to perform properly.

Can anybody please tell me that how can I decrease this response time to the minimum and how can I make my blog to load faster or how to optimize the performance of my server.

Details -
blog - http://thatsbreaking.com
OS - CentOS
CMS - WordPress
cPanel - Yes.

Let me know if I need to share more information.
Thanks and have a nice day!

4 Answers

just checked your site. speed is not that bad.

but you could improve the performance further by using a CDN. also try using varnish or radis to improve response time instead of wp super cache

https://www.digitalocean.com/community/tutorials/how-to-configure-redis-caching-to-speed-up-wordpress-on-ubuntu-14-04

by Scott Miller
Redis is an open-source key value store that can operate as both an in-memory store and as cache. Redis is a data structure server that can be used as a database server on its own, or paired with a relational database like MySQL to speed things up. For this tutorial, Redis will be configured as a cache for WordPress to alleviate the redundant and time-consuming database queries used to render a WordPress page. The result is a WordPress site that is much faster.

Which version of PHP ?

Are you sure you've running CentOS, because your server says it's Ubuntu (from the Server-header) ?

Running the site through WebPageTest.org from Singapore says it's Time to First Byte is about 0.5 seconds, so where are you seeing the 2.5 to 5.0 seconds response ?

Depending on the amount of plugins in your WordPress, that's usually the first place to start removing some and replacing others with better ones.
I would recommend installing a certificate (LetsEncrypt is free) and run your site over HTTPS, since this will allow the use of HTTP2, which uses only one connection.

There's a ton of different optimizations that can be done to Apache, PHP and MySQL, but it's important to look the right place, so you need to give further details to pinpoint where to start.

@hansen yes you are right the current version of OS is Ubuntu. Actually I was using cPanel with CentOs, but then the cPanel license expired and I thought I don't have that much use of Cpanel, so I created a WordPress droplet instead and transferred my blog to that. My blog is performing little bit faster now, than my previous one.
Thanks for suggesting me to run the blog over HTTPS, I am already learning about it and will install it as soon as possible.
I would love to hear some guidance that where from I should begin to optimize the performance of my blog or of my server and let me know what other details you want me to share, so that it will be easy for you to share the exact tips.
Thanks for the time and have a nice day!

  • I would say, start with HTTPS over HTTP/2. Then you've also added an extra layer of security.

    Then remove any plugins and templates which are not used (no just deactivate them). That's for speed and security too.

    Then look through all the plugins which you use and figure out if it's the best choice. Sometimes a new plugin comes around and does the job faster than an older plugin.

    After you've cleaned up WordPress, then you can start trickle down to the lower layers, such as adding Redis as newbie wrote, but I would probably start by optimizing Apache, PHP and MySQL first.
    Remember to run PHP 7+. That'll give you almost 50% extra power.
    You can do a Google search for "apache optimize" or "apache tuning", and do the same for PHP and MySQL. You can even find a lot of good articles with "wordpress speed optimize".
    Again, just because you read something in an article, doesn't mean you have to implement it. Think critical.

    But all in all, it seems like your biggest problem is the amount of sources on your blog. Each source (image, style sheet, javascript) requires a new connection and you also have content placed on many different CDNs.
    Moving you entire blog to HTTP/2 will lower the amount of round-trips by tunneling each source over a distinct server connection.

    Also install htop on the server with apt install htop. Then run htop command. This will give you a good overview of your servers resources and it'll tell you if something is taking a lot of resources.
    While we're at it, install the new do-agent - this helps monitoring your server via the DigitalOcean control panel.
    https://www.digitalocean.com/community/tutorials/how-to-install-and-use-the-digitalocean-agent-for-additional-droplet-graphs

I have been getting "Reduce server response time" issues with the Pagespeed Insights tool.

To test whether it is due to some slow PHP script or Wordpress or hosting issue, I duplicated my website at Digitalocean and pasted it in Google Cloud - Google Compute Engine instance.

Problem solved! In Google Cloud I'm able to get faster server response times and pass the Pagespeed test with flying colors even with the smallest VPS in gcloud.

So it's not due to PHP or Wordpress. Digitalocean server has server response time issues. The difference was between 300ms and 1s.

Have another answer? Share your knowledge.