HTTP2 - SPLessons

HTTP2 Stream Priorities

Home > Lesson > Chapter 7
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

HTTP2 Stream Priorities

HTTP2 Stream Priorities

shape Introduction

This Chapter demonstrates about the Stream Priorities HTTP/2 ability to define the priority of a stream which have the single multiplexed connection in which responses are received makes a big difference in performance. Following are the concepts covered in this chapter.
  • Stream Priorities
  • Defining Priorities

Stream Priorities

shape Description

HTTP/2 stream have prioritization weight which is an priority i.e range from lowest priority is 1 and highest priority is 256, and many streams are may be made dependent on other streams. Proiritization is an order of files are requested and in which the server retrieves the data. The figure below demonstrate the Stream Priority. Stream Dependency Streams are always isolated which means one stream is always dependent on other streams. If the streams have no dependency then dependency ID is set to zero which is also known as the root the figure below demonstrates the Stream Dependency. Dependency Tree Dependencies on linear they can form a tree in which references two streams share the same parent tree The figure below demonstrate the Dependency Tree. In the above figure Stream 3 and Stream 4 have the same parent as Stream 1 i.e Stream 3 and Stream 4 share the all the properties of Stream 1. In order to know the how two priorities will work let assume index.html page on stream 1 and style.css page on stream 3 in which stream parent dependency of stream 1 the figure below demonstrates the how Dependency work. Sharing Parent Streams some times share the parents when it come to dependency in which resource allocation is calculated proportionally to the wait of each dependency the figure below demonstrates the Sharing a parent stream. In the above figure stream 3 has a weight of 10 and stream 4 has a weight of 5 to calculate the allocation the sum of weight of all the siblings and then divide each weight by the sum total is shown in the above figure.

Defining Priorities

shape Description

Priorities defining can be done in in two ways in which first one is the start exchange by using the HEADERS frame using the priority log which is used to set the priority for the requested resource. The second option is to use Priority frame which is appropriate when wanted change the priority of the stream

Using Header Frames

shape Description

When using the header frame the priority flag should be set along with the weight and stream dependency where applicable. Stream dependency is value of (31 bits) and weight should be the (8 bits) the figure below demonstrates the HEADERS Frame as shown below.

Using Priority Frame

shape Description

User needs to change the priority mid way user can use the Priority Frame which has the same features for setting priority in the headers frame. Priority frame can be sent when the stream is in any state. The given frames aren't live nothing can priority frames not alive after whole other frames from the same stream have been processed in which case priority frame would not have any impact The figure below demonstrates the Priority Frame as shown below.

Exclusive Flag

shape Description

Both the HEADERS Frame and Priority Frame have a bit named 'E' which is known as Exclusive flag in the case whether the stream becomes the only depend the only one on its parent The below figure demonstrates the Exclusive flag. In the above figure Stream 3 and Stream 4 depending on Stream 1 And Stream 5 setting its Exclusive flag as 1 and which is dependent on Stream 1 in this case stream 3 and stream 5 dependent on stream 4 which is very useful for having the ability during the priority change to set a higher priority with the stream.

Summary

shape Key Points

  • Every stream can be depends on other streams.
  • Header frame and Priority frame have the Exclusive flags.
  • Streams can share the parents when it comes to dependency.