Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When do you want more/less http requests? [closed]

It seems like to have you page load fast, you would want a series of small http requests.

If it was one big one, the user might have to wait much longer to see that the page was there at all.

However, I'v heard that minimizing your HTTP requests is more efficient. For example, this is why sprites are created for multiple images.

Is there a general guideline for when you want more and when you want less?

like image 650
cade galt Avatar asked Nov 10 '15 12:11

cade galt


People also ask

What does make fewer HTTP requests mean?

Generally, fewer HTTP requests mean a faster loading website. The loading speed of a website is now an important search engine ranking factor. On average, the media page loading speed for Google's 10 results is just 1.65 seconds. This highlights the importance of having a fast-loading website.

How many HTTP requests is too many?

How Many HTTP Requests Should Web Pages Have? You should strive to keep the number of HTTP requests under 50. If you can get requests below 25, you're doing amazing. By their nature, HTTP requests are not bad.


1 Answers

Multiple requests create overhead from both the connection and the headers.

Its like downloading the contents of an FTP site, one site has a single 1GB blob, another has 1,000,000 files totalling a few MB. On a good connection, the 1GB file could be downloaded in a few minutes, but the other is sure to take all day because the transfer negotiation ironically takes more time that the transfer itself.

HTTP is a bit more efficient than FTP, but the principle is the same. What is important is the initial page load, which needs to be small enough to show some content to the user, then load additional assets outside of the user's view. A page with a thousand tiny images will benefit from a sprite always because the negotiations would not only cause strain to the connection, but also potentially the client computer.

like image 170
Flosculus Avatar answered Oct 22 '22 13:10

Flosculus