0

I could not found this RFC, and I'm wondering are there any rules regarding how resource requests from HTTP/2 Client are mapped into HTTP/2 streams.

Is it one-to-one, where each stream represents data for one resource request (e.g. image, js, html) or it is possible to use one stream to transfer multiple resources ?

How stream priories differs from stream dependencies (for me both are directly influencing final order of resource retrieval) ? Are there any general strategies how browsers are handling streams and streams dependencies ?

Many thanks for help!

Midi
  • 459
  • 1
  • 5
  • 19

1 Answers1

1

I could not found this RFC, and I'm wondering are there any rules regarding how resource requests from HTTP/2 Client are mapped into HTTP/2 streams.

Is it one-to-one, where each stream represents data for one resource request (e.g. image, js, html) or it is possible to use one stream to transfer multiple resources ?

From the HTTP/2 RFC:

Multiplexing of requests is achieved by having each HTTP request/response exchange associated with its own stream (Section 5).

and also later:

Stream identifiers cannot be reused.

As to your next questions:

How stream priories differs from stream dependencies (for me both are directly influencing final order of resource retrieval) ?

They are part of the same prioritisation scheme. Dependencies allow for certain resources to be sent in preference to others, whereas priority weighting allows resources to be sent at same time but weighted to proportion more of the available bandwidth to some resources.

Are there any general strategies how browsers are handling streams and streams dependencies ?

They all handle streams the same way but dependencies are handled completely differently.

  • Chrome uses dependencies a lot and creates a long chain on single dependencies that should be resolved in order where possible. Higher priority resources are added further up the chain. Chrome does not use weighting a.

  • Safari does the opposite and sends all requests without dependencies but with appropriate weighting.

  • Firefox creates a complex dependency tree using both weighting’s and dependencies.

  • Old Edge does no prioritisation so uses HTTP/2 default of equally weighed resources with no dependencies. New Edge is based on Chrome so follows that.

It’s generally accepted Chrome is usually better, but suffers when downloading resources that would be better downloaded in parallel (e.g. images - especially progressive JPEGs). Firefox does better here but is slightly less optimal for resources that need to be downloaded in its entirety (e.g. critical CSS and JS). Safari’s only OK and usually worse than both. And old Edge was the absolute worst. This is a good talk on the state of affairs: https://m.youtube.com/watch?v=sgjxuhFQktE

For HTTP/3 they are looking at changing their complex model. Good talk on that here: https://m.youtube.com/watch?v=nH4iRpFnf1c&feature=youtu.be

Community
  • 1
  • 1
Barry Pollard
  • 40,655
  • 7
  • 76
  • 92