Digital.gov Guide
Eight principles of mobile-friendliness
Properly configure the server
Week seven of our series covers configuring servers to optimize response time.
Reading time: 4 minutes
Welcome to Principle 7!
Like any piece of technology, a web server needs to be tuned for peak performance. While mobile devices continue to improve generation after generation, if the server at the heart of your site is not optimally configured, it may deliver a suboptimal experience to your users. Such poor performance may negatively impact the usability of your site and can be detected using Google’s Mobile Friendly Test tool, DigitalDashboard.gov, or the Information Technology & Innovation Foundation (ITIF) Benchmarking Report.
Improve Server Response Time
Ideally, server response time should be less than 200 ms (milliseconds)
Server response time is the average amount of time it takes for a server to respond to a browser request. It is a measure of how long it takes to load the necessary HTML to begin rendering the page, which reduces the network latency between Your browser and your server.
Suggestions for “tuning” your server
There are many things that may slow down your server’s response. Optimization of hardware and drivers, OS and its TCP/IP stack, and library and application-level tuning should be considered to improve your server’s response time. The first step is to measure server performance metrics. Then, consult your network and server administrators for their thought for how to address the challenge, and finally, continue to monitor the system.
The following are some (not all; there are many more) key impacts to server performance to consider assessing:
-
Website Resource Usage
More efficient webpages use fewer resources allowing the web page to be served up quicker.
Reduce Server Trips - Each thing a page has to do in order for it to render adds overhead. The average page likely loads several stylesheets, scripts, and other resources (like images) from your own server. Each trip between the site and the server takes time, and there may be ways to reduce the number of trips. To find out how many requests your webpage is making, you can use the Varvy Page Request Tool which will tell you how many resources it is using for each page load.
Reduce the Page Weight – Fewer resources required to render a page means a faster rendering of that page. Reduce the size and amount of resources required by combining and minifying where possible, and optimizing CSS and JavaScript code by embedding it and running it inline. See Principle 5 - Conserve Resources, Recycle When Possible and Principle 6 - The Smaller the Better, When It Comes to Page Resources! to go deeper in to making your site perform better. -
Web Server Software
Changing your web server software or configuration may improve server response time (again, consult your network and server administrators). There are many types of web server software, including: Apache, Nginx, and Litespeed. No matter what web server software you are using, it should be optimized for your own needs. However, server optimization and tuning can be a challenge— in How to Optimize and Speed Up Your Server by More Than 20%, Hamish Oscar Lawrence recommends that one starts by tuning the following nine areas:
- Enable caching
- Setup a fast reverse proxy
- Choose the right application server
- Fine tune your web server once a month
- Turn on HTTP/2
- Defragment your database tables & optimize server settings
- Fix your DNS query speed
- Trim down your site’s critical rendering path
- Disable resource intensive services
Also, if you are using a Content Delivery Network (CDN), check to make sure it is configured properly. If it is configured to store your files in different locations around the world, a CDN will allow users all over the world to see your pages faster because they are receiving files closer to their physical location. -
Website Traffic
The more traffic a website gets, the more server resources are required. A website that is quick on initial deployment may become slow over time as traffic increases. This is why continuing monitoring is required.
Each situation and configuration is unique, so you may need to bring your network guys in to help.
References
- Essential Server Performance Metrics you should know, but were reluctant to ask | http://www.monitis.com/blog/essential-server-performance-metrics-you-should-know-but-were-reluctant-to-ask/
- How to Optimize and Speed Up Your Server by More Than 20 Percent | https://bobcares.com/blog/how-to-increase-your-server-speed/
- Improve Server Response Time | https://developers.google.com/speed/docs/insights/Server
- Optimizing web servers for high throughput and low latency | https://blogs.dropbox.com/tech/2017/09/optimizing-web-servers-for-high-throughput-and-low-latency/
- Server Response Time | https://varvy.com/pagespeed/improve-server-response.html
- Page Speed: Improve Server Response Time | https://gtmetrix.com/improve-server-response-time.html