0

I was reading through https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f

A line says

Yes, but because HTTP/2 is coming now multiple HTTP requests are actually better.

Embedded within all the sarcasm in that post, this statement is presented as to be true. So, I would like to know whether this statement is actually true? and is yes then how are multiple request better? From what I know from the computer networks class is that for each new linked resource, a bunch of messages or packets are exchanged between the end hosts i.e. eating the resources/time/space on all the routers/bridges on that path.

mtk
  • 13,221
  • 16
  • 72
  • 112
  • analogy: what's more efficient: 1) buying groceries by driving to the store, buying item 1, driving home, putting it away, driving back to the store, buying item #2, driving home, etc... or 2) driving to the store, buying items 1,2,3,....n, driving home, and putting them away. – Marc B Oct 03 '16 at 21:30
  • Possible duplicate of [Optimizing File Cacheing and HTTP2](http://stackoverflow.com/questions/35588692/optimizing-file-cacheing-and-http2) – Barry Pollard Oct 04 '16 at 06:24

1 Answers1

0

In Http/2 multiple requests mean a slightly different thing than Http/1.1. Http/2 tries to utilize a single connection request system where the connection is closed after the page has completed all tasks. This way you can have dynamic loading of smaller pieces of a library and share the overhead which would amount to a smaller download overall then one large js file which is efficient in Http/1.1.

Marc B had it right with the Groceries analogy in which Http/2 is one trip to the server which grabs multiple pieces and returns vs Http/1.1 is a series of trips to grab the same pieces.

Justin MacArthur
  • 4,022
  • 22
  • 27