Support

Find answers, guides, and tutorials to supercharge your content delivery.

How to Improve Server Response Time

Updated on October 4, 2018
How to Improve Server Response Time

Server response time is an important value to track as all website assets are indirectly dependent upon it. If your server response time is slow, then your whole site will be slow, no matter how optimized your other resources are. According to Google and other speed test tools, such as GTmetrix, you should aim for a server response time of less than 200 ms.

In this post, we'll cover what exactly server response time is, things that can affect server response time, and how to improve server response time.

What is server response time?

Server response time is the amount of time required to load the HTML document of a website from a server so that the client can begin rendering the page. Without a good server response time, the HTML document will take longer to load. If the HTML document isn't loaded, that means the browser won't know what other resources will be required in order to display the page properly.

The response time of a server is typically measured with what is known as time to first byte (TTFB).

As you run several speed tests, you may see a slight variation in the TTFB number, however, for the most part, it should be more or less consistent. Slight variations can be caused by a variety of factors that affect latency. Although, if you're experiencing significant differences, this may indicate a more severe underlying performance issue.

Things that affect server response Time

There are a few factors that can come into play when discussing reasons why a server's response time is slow. These include:

  • Poor web hosting - A web host that uses legacy hardware/software will result in a slower response time for the user. Furthermore, even if your hosting provider offers the most up to date equipment available, there are various hosting options available. Typically, web hosts offer (at a minimum) shared hosting, VPS, and dedicated hosting solutions.
  • Increased traffic - Increased traffic means more resources are being used. Therefore, if your server's capacity level is reached, then visitors will experience slower response times or even error codes such as bandwidth limit exceeded.
  • Bloated webpages - Webpages can get pretty bloated if the right optimization practices aren't in place. This includes things like oversized images, non-responsive images, non-minified CSS/JS files, etc.
  • Lack of caching - Caching is a crucial step in delivering content faster to users. However, the lack thereof creates unnecessary waiting periods due to the fact that the browser must request assets from the server every time instead of accessing them from a local or intermediary cache.

How to improve server response time

In the previous section we discussed things that affect server response times. In this section, we'll be addressing those concerns and explaning how you can begin improving the response time of your own server.

Choose a reliable web hosting provider

If you're experiencing sluggish performance, it may be time to upgrade your hosting package or change providers. Try to stay away from the cheapest web hosts as typically the performance you'll experience will reflect the price you pay. In the event that you're using shared hosting (meaning you are sharing server resources with other websites), it might be time to upgrade to a VPS or dedicated server depending on your requirements.

Learn more about the differences between the aforementioned hosting options in our what is a virtual private server article.

Compress, minify, optimize, and cache

Caching greatly helps in improving a server's response time as the HTML document can be accessed much faster. If you're a WordPress user, consider using a caching plugin such as Cache Enabler. A caching plugin will generate static HTML files instead of loading all of your website's assets dynamically. Furthermore, you can also take advantage of a content delivery network to take your caching strategy a step further once your HTML document has been loaded and you need to now load your other static assets.

Once you have your caching strategy in place, it's also extremely important to compress your assets using a method such as Gzip or Brotli, minify your CSS, JS, and HTML files, and optimize your images.

Optimize your web server

Not everyone may feel comfortable doing their own web server optimization, however, ensuring that your server is fully optimized will help further reduce your server response time. When it comes to choosing server software, there are a few options available; although most users opt to use either Apache or Nginx. There are pros and cons to each web server although Nginx has been known to offer better performance in many circumstances. Learn more about the difference between Nginx vs Apache.

Furthermore, regardless of which web server software you're using it's important to configure it to define expiry rules such as the case with browser caching.

Improve database performance

Apart from the recommendations mentioned above, it's also important to ensure that your database's performance is optimized. There are various ways to go about optimizing database performance and it can potentially turn into a large undertaking depending on the current state of your existing database. Doing things like rewriting your queries with performance in mind, changing your schema to group objects and using indexes are a few ways you can optimize database performance.

For a more comprehensive list of suggestions on how to improve database speed check out our complete path to improving database performance.

Summary

Overall, if you have a server response time or TTFB of over 200 ms, it's time to take a look at your stack and start making changes to get that number down. The faster your server response time is, the more likely users will stay on your page for a longer period of time, and the less likely they will bounce as they wait for it to load. Take the recommendations in the article and implement them into your own site to start improving the response times of your server.

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more