When do you want more / less HTTP requests?

It seems that you are loading the page quickly, you will need a series of small HTTP requests.

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

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

Is there a general rule when you want more and when you want less?

+4
source share
4 answers

EDIT 2 (08/25/2017)

; , HTTP2 () . .

( ):

, HTTP/2.0 :

, , , HTTP/1.1 TCP. " " HTTP.

parallelism, , .

HTTP/1.1, (. ), ( ) HTTP-, , URI , , .

, HTTP/2.0 HTTP/1.x, ( 2- > 1, 1- > 2).

.

( ) , HTTP2 , HTTP1. HTTP1 ( "" ) ~ 8 ( ), , HTTP2 . , , , , . , - 8 . :)

HTTP2 , caniuse :)

EDIT (30-11-2015)

" ". , , .


, 2.

-, , HTML, CSS, JS - , PHP/Rails/Django ( 10000+ -) MySQL.

- , . , , .

, (, CSS, JS), HTTP, . , DNS.

DNS, , , . , -.

, , JS CSS JS CSS, . , ( ), JS CSS, -, .

, script -, AJAX. - , script, , .

, , , , , , , -, . ! , first - - , , .

, - . , - , , , . .. ( ).

HTTP- , , "DNS-" .

, , , javascript async defer.

async , script , , HTML. HTML script.

-. async, HTML .

, "", , , jQuery, -, , async , .

-, "", , google script, - , , :

, JS , , HTML- JS - script , HTML CSS , JS HTML.

HTTP-, , " ", , .

-, http://github.com /fooobar.com/..., , , , .

, , . - -, , , , , , , , . IE/Edge , (, ).

, , , , .

!

+2

, .

FTP-, 1GB-, - 1 000 000 MB. 1GB , , , .

HTTP FTP, . , , , . , , .

+7

HTTP , . , , . , , TCP- .

, , RESTful (, ).

, , - , . , , .

0

.

The reason we separate javascript / css code in other files, we want the browser to cache them, so that other pages of our site load faster. If we have a site with one page without shared libraries (e.g. jQuery), it is best to include all the code in your html.

0
source

Source: https://habr.com/ru/post/1615250/


All Articles