Reducing Server Requests
When you’re visiting a website, how does your browser know what to load? Simply put, your browser requests information, such as CSS, Javascript, and HTML from the website. These browser requests are known as HTTP Server Requests. In this video, we'll be covering how these Requests can affect your site's performance.
0:28s
First, your browser will make several HTTP Server Requests per page. How many requests it makes is dependent on how your site is developed.
For example, when you load a webpage, the browser is sending a unique request for each of the sites assets such as CSS, JavaScript, images and so forth. Understanding that, you can see that having too many of these requests can slow down your user's experience.
You may be wondering, what can I do to minimize the amount of requests my website is making? We’ll walk you through 2 ways to reduce the number of requests made. First, is by offloading requests to a third party service and second is completely removing a request without affecting your site.
1:11s
Let’s talk about offloading first. Offloading specific requests to a third party allows your server to focus on other processes, thus creating a faster visitor experience. If you have integrated any social media on your site, you’re already offloading requests!
But you may be wondering what other kinds of functionality you can offload. Typically, we see websites offloading comments, images, or related posts to third party services such as Disqus and Jetpack. let's look at Disqus as an example.
Disqus saves the comments from your website onto their servers and when a visitor loads a page with comments, your website will make a request to Disqus to pull in the comments.
Compare this to having your server handle comments. The browser would request all the CSS, Javascript, comment contents from the database and all the avatar images from your server. Depending on the complexity of your commenting system, this can be a lot of requests that could simply be offloaded to another service to handle.
It's important to understand that not every piece of functionality should be offloaded to a third party service. Once functionality is offloaded, it now relies on the speed of that third party server. So if a certain piece of functionality is mission critical, having full control of it is important and best practice suggests that you handle that on your own server.
We recommend talking to your developer or looking around the WordPress community to find popular third party services that you can offload functionality too.
2:59s
Now let’s look into actually removing requests without affecting your site's appearance. One way of doing this is through the process of minification which combines multiple files of the same type into one file.
For example, if you have 5 CSS files being loaded on your site, minification will grab all 5 and combine them into one file. This essentially removes 4 requests from your page load.
To accomplish this, you can ask your developer to combine the files for you or WordPress has many plugins that will do this process on the fly such as Better WordPress Minify. Just remember, before doing any major changes like this, be sure to make a backup of your site. Once minification is completed, be sure to visually verify that your site looks and works properly.
After your page completely loads and all requests are done, your site can still make requests through a process called ajax. This allows your site to request information after the page is loaded. If you have an increase in traffic and each page load fires an ajax request, you can see slow performance or even outages.
You should now have a basic understanding of HTTP Server Requests and how they affect your server's performance. If you have any questions, there is a multitude of resources available outlining these two topics. But if you have any specific questions about this relating to your site, feel free to contact your WP Engine support team.
HTTP Server Requests can affect your site's performance. HTTP Server Requests are what the users computer sends to your server in order to load up a web page. When you visit a single page it does not mean there is only one http request. Keeping these to a minimum will ensure that your site is running fast.
In this video we will show you how to identifiy your total server requests and give some tips on minimizing them.