How to reduce server response times?

Published on

While optimizing a website for a greater performance we need to improve its foundation, which is server response time or time to first byte (TTFB). In an earlier article we learned about the TTFB, and we learned that the server’s latency affects the website speed.

When we test a website on tools like GTmetrix, Lighthouse, PageSpeed Insights, or any other site benchmarking tool; if the website’s response time goes over 600ms then we get an error to reduce server response times. How can we do that?

DevTools: Waterfall
DevTools: Waterfall

In this article, we’ll learn some quick steps to reduce server response times.

Use a cache (only for dynamic sites).

A dynamic website is always slow, and it gets slower when many users are accessing the same page at the same time. We can solve this issue at a very large extent by simply installing a caching plugin or using a server side cache.

If you are using WordPress you can use WP Super Cache plugin which is easy to set up. But I personally do not favor another PHP/Plugin based solution because that too uses system resources to generate a static copy of a webpage, instead I recommend and use a server side cache solution like FastCGI cache with Nginx which is faster and scalable.

So, if you are on shared server better use WP Super Cache like plugin with recommended settings enabled. VPS users who can customize the server can use server side cache.

Do you know? Just by caching website pages you can reduce up to 90% system resource, and never clear the cache unless there is a need of it.

Often clearing cache will not be effective at all, it will waste server resources.

Prepare website pages faster.

We need to optimize the website to prepare website pages faster, and we can achieve this by using highly optimized and well coded theme and plugins. A well coded system will work faster and sets low load on server resources.

This section is more of a learning curve, as we need to dig into codes sometimes.

Optimize database (only for dynamic sites).

CMS (Content Management System) based sites (Ex. Drupal, Magento, WordPress) uses a database to store and serve contents on a website. So, we should optimize how our server queries databases, reduce the number of queries, or migrate to faster database systems.

We should often clean the database for any old data which is not required as increasing database will slow down the website if not managed well.

Upgrade server hardware.

Finally, look for an upgrade, by having more memory and processor will speed up your website from its core. Trust me you’ll feel the performance gain instantly by upgrading.

Leave a Reply

Your email address will not be published. Required fields are marked *