×

While server response times are usually not the primary bottleneck when it comes to slow page response and load times (slow server response times typically account for only 10% of the total delay time), there are still ways you can optimize your response times to improve your page’s performance.

image00

Using Rigor’s Waterfall Charts, you can analyze how long it takes for the server to respond to a request.

The server’s response time to a request is determined as follows:

Server Response Time = Time to Load HTML Necessary for Rendering Network Latency Between Your User and Your Server

Basically, server response time is how long it takes to hear back from your server (also referred to as time to first byte, or TTFB), and this is an important metric since nothing else can happen until your HTML is received. According to Google’s PageSpeed Insights, a good rule of thumb is to ensure that your server response time falls below 200ms.

Factors Influencing Server Response Times

While there are many factors that influence how quickly your server responds, making it difficult to pinpoint exactly where the bottleneck is, the following are are some of the primary factors in how fast your server responds:

  • Databases: How optimized is your database? How fast are your queries? Generally, the primary bottleneck when it comes to your server response time involves your database.
  • Traffic and Hosting: How many requests are made to your server? How good is your web host? Have you purchased enough resources to handle the traffic you are getting?
  • Resource Usage: How many and how resource-intensive are the files required to render your webpage? Are you caching your resources effectively?
  • Server Software: How efficiently configured is your server’s software? Are you using your server’s default settings, or have you configured your settings so that they are appropriate for your needs?

Ways to Reduce Server Response Times

There are two basic ways to reduce the amount of time it takes your server to respond to a request:

  1. Use your existing resources more efficiently;
  2. Upgrade your resources.

We will discuss both options above with regards to each of the factors that influence server response times.

Databases

If your site relies on retrieving data from a database, ensure that you have it optimized to perform as well as possible. In addition to speeding up the overall performance of your queries, a well-run database prevents even parts of your site that don’t use the database from slowing down. Slow queries are generally the number one reason why a server responds to a request slowly.

While this article won’t go into detail on how to optimize your database, you should definitely prioritize analysis of your database response times if you’re trying to decrease your server’s response time. Most of the time, simple solutions such as the following should make a sizable difference. In the long-run, there are essentially four ways to optimize the performance of your queries:

  • Rewrite the queries: do your queries return only what is necessary? How many queries are you running? Are they written with performance in mind (for example, are you using joins instead of looping through data repeatedly?)?
  • Use the appropriate indexes: do your tables have the appropriate indexes?
  • Change your schema: is there a better way to group objects such as tables, views, and stored procedures?
  • Use external caches: can you move some of the load from your back-end to your front-end?

Traffic and Hosting

The first thing to check with regards to your web host is whether you have sufficient resources for the amount of traffic your site receives. More traffic to your site results in a longer wait time for your server to respond, which results in fewer users being served during a given period of time.

In addition, you should consider the amount of resources required per user. For example, if your site requires 20 resources to render for each user, one user will be making at least that many calls to your web server.

As the amount of traffic you receive increases, you’ll need to upgrade your hosting. The following are options available to you, listed in order from most economic (and therefore best for lower amounts of traffic) to those where you can maximize performance.

Free Hosting This is a good choice if you want to build a non-critical website that won’t see a lot of traffic. In exchange for free hosting, you’ll see slow connection speeds, large amounts of downtime, and advertisements on your pages.
Shared Hosting For a low fee, your website shares resources with other websites, including the physical server and the software applications installed on to the server. The quality of service, connection speeds, amount of downtime, along with other factors, vary depending on the host you select, the subscription option you choose, and so on.
Virtual Private Server (VPS) Hosting A cross between shared and dedicated hosting, VPS hosting involves multiple users sharing a single server. However, the server’s space is strictly allocated so that a given website can only use its allocation; the primary downside to this feature is that, in the event of unusual demand, a given site will not be able to expand its resource use.
Dedicated Hosting Your website is given its own web server, which allows for fast performance. Because you are not sharing resources with anyone else, you are responsible for the full cost of the server. In addition to receiving a greater amount of system resources to use, you will typically receive higher levels of security with regards to the integrity of your site.
Collocated Hosting Your website runs on a server that you have purchased yourself. You can house this server in any number of places: in-house, at a dedicated web host facility, and so on. In addition to being the sole user of the server’s resources, you have full control of the software that the server runs, so you can install whatever scripts and/or applications you need.

Resource Usage

The typical web page includes HTML files, assorted style sheets, scripts, and other resources like images. All of these things require time to download, and style sheets and scripts are considered to be render-blocking, which means that the browser stops parsing the HTML when it comes across one of these resources and needs to parse the relevant file(s).

Some ways to reduce the resource usage of your site include:

    • Reducing the number of resources required: Can you consolidate files?
    • Using inline style sheets and scripts: For small amounts of styling and scripts, could you include this in the HTML to eliminate calls to request and fetch these resources?
    • Deferring resources that aren’t immediately necessary: Can you delay the parsing of certain style sheets? Can you mark scripts as “deferred” or “asynchronous”? Can you defer the loading of images?
  • Minifying your resources: Can you reduce the file size of your resources by eliminating developer crutches that make code human-readable, including whitespace and comments? Can you rename function and variable names in your scripts so that they are shorter?
  • Compressing your resources: Is your server sending compressed files?

Additionally, you should strongly consider caching as much of your site as possible. Does every call merit a new request, or can you leverage the browser’s caching behavior? Could you use a Content Delivery Network (CDN) to reduce the strain on your server?

Server Software

Regardless of which web server you opt to use for your web page, you can improve your server’s response time by configuring its settings to better suit your needs. For example, Apache, a free option that is one of the most used web servers on the web, is not the best performer if you install and use its out-of-the-box configuration, but it can be customized for high performance.

In general, you should consult the documentation pages for your particular server configuration for recommendations on what you should change based on your usage and needs.

Alternatively, you might consider using other web servers. You can certainly select a paid option that comes with custom support and configuration, but there are free options as well that provide good performance.  For example, Nginx, a free web server option, typically performs much better than Apache, even using its out-of-the-box settings.

Conclusion

While server response times account for only 10% of the total delay time in delivering your site to your users, there are nevertheless ways for you to maximize your server’s performance and reduce any lags. By considering the amount of traffic you receive, your database and its optimization, your hosting and server software solutions, and the resources required to generate your site and optimizing these factors, you can work to reduce the amount of time it takes for your server to respond to a request.

Trying to improve your web performance? Book a kickoff call to start a Rigor Monitoring trial. 

Suggested Blog Posts

Mobile Banking a Top Priority for Financials

As mobile devices continue to play a more prominent role in our 21st century society, their usefulness has spread beyond the casual activities of technological enthusiasts. According to research conducted by FUNDtech, a rapidly growing number of ba...

Read More

The Perception Gap for Poor Web Performance

E-commerce is a growing source of revenue for many companies and businesses, as it continues to capture market-share from brick-and-mortar stores over recent years. However, many businesses are not prepared for this growth of online business becau...

Read More

Measuring Cross-Browser Performance

In recent years, client-side browsers have been more involved with processing code before it reaches the user's desktop, shifting away from a reliance on servers handling the bulk of this burden. Websites and applications now rely more on a user's br...

Read More

Using Browser Trends to Maintain a Better Site

Because of the multifarious nature of web clients today, it’s important to consider the usage statistics when designing, implementing, and managing your site. However, misconceptions often arise when determining what browsers to design for an...

Read More
  • How does compressing resources (CSS/JS/HTML) help reduce Server Response Time (TTFB) ?

    You say Nginx outperforms Apache. Could I see a study?

  • Great and thanks for the useful article.

  • Thanks for such a useful article.