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

Posted February 25, 2017 46.1k views
CentOSApacheServer OptimizationWordPressLAMP Stack

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 -
OS - CentOS
CMS - WordPress
cPanel - Yes.

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

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.

Submit an Answer
6 answers

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 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.

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.

  • I’m getting similar results between Linode and DO. I love DO for it’s ease of deployment, but their response time is killing me.

    Running some nodejs apps, some Laravel deployments, Wordpress, and OctoberCMS over a variety of droplets across 2 accounts and response time is pretty consistently slow, servers themselves are fast.

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

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.

Server respon time occurs because of some situations, such as a high load server, or a high iowait disk, based on my experience nginx the best in terms of response time, better use ha proxy load balancer, and do not forget to choose an experienced hosting provider.

edited by MattIPv4

Some tips for speed optimization of the Laravel website

Google Maps or some other 3rd party tools might generate some errors that in turn, decide your speed. Also, heavy CSS and JavaScript needed to be refectories to make them smaller.

The best way is to use a template that is well coded and does not use many plug-in. Configure web servers.

Your web server needs to be configured properly to improve the speed of the web application. What a web server does? It controls gzip and cache settings that are required for a high ranking score. What to do for web server configuration?

For caching, enable caching on JS/CSS/Images for at least 7 days.
For gziping, you need to gziped all your files to improve the page speed score. Hire Laravel developers from a leading Laravel development company who have in-depth knowledge and experience of configuring web servers. Ask them about it while taking their interviews.

Laravel configuration:

For Laravel application configuration, you need to do the following things.

  1. Minify CSS/JS It is very easy and can be done by using tools such as Elixir. You can also do it by manually minifying and combining your CSS/JS.

  2. Minify HTML There are different packages available for minifying HTML automatically.

  3. Cache 3rd party resources The main issue arising here is that Google Analytics sets a low cache time and Page Speed Insights requires a long cache time. You need to catch the script locally temporary to improve the page speed.

  4. Templates putting up into Laravel Once you have selected the template for the website; you need to put it in Laravel. First of all, you need to copy assets.

edited by MattIPv4