completefrontend
Open lab My progress
THE WEB PERFORMANCE FIELD GUIDE

HTTP prioritization internals

How Chrome tells HTTP/2 and HTTP/3 servers which response matters most, what servers and CDNs really do with it, and how to test yours.

By the end, you can
  • 01
    Read Chrome's priority signalsRead the old HTTP/2 tree and the priority header Chrome sends, and say why the tree was replaced.
  • 02
    Predict a server's orderUse urgency and incremental to say which response a server that follows RFC 9218 sends next.
  • 03
    Know what servers and CDNs doSay what quiche, Cloudflare and h2o do with the signal, and why a full buffer can undo it.
  • 04
    Test your own serverSend a late urgent request behind many slow ones, and read the result in DevTools, a NetLog or a qlog.

One photo, three servers

Ravi gave the Mint tea photo fetchpriority="high", as Load the LCP resource early showed. DevTools now lists the photo at High. Then Ravi moves the shop to a new server. The page and its files stay the same.

That evening, Asha opens the page on her phone at home. The photo takes twice as long as before. Chrome still asks for it first. So who sent it late?

Chrome only asks. The server decides what to send. Over HTTP/2 and HTTP/3, one connection carries many responses at once. Each response travels in its own stream. Any packet can carry bytes of any stream. So before each packet, the server picks: whose bytes go next? That choice is called prioritization.

The course built three servers to see it. All three are the same program, on Asha's home line. Only the order they send in is different:

  • One follows the priority that Chrome asks for.
  • One takes turns: a packet for each response, round and round.
  • One sends in request order: each response whole, in the order Chrome asked.

Here is when the photo's last byte arrived from each one:

When the photo's last byte arrivedPop out in the code editor (opens in a new tab)JavaScript
// When the Mint tea photo's last byte arrived, in ms after Asha opened the page.// The middle of three visits from each server.const photoDone = { follows: 316.7, takesTurns: 670.5, requestOrder: 317.1 }; console.log(`Server that follows the priority: ${photoDone.follows} ms`);console.log(`Server that takes turns: ${photoDone.takesTurns} ms`);console.log(`Server that sends in request order: ${photoDone.requestOrder} ms`);
  • Lines 1 and 2 are comments. Each time is in milliseconds (ms), and is the middle of three visits.
  • Line 3 holds the three recorded times.
  • Lines 5 to 7 print Server that follows the priority: 316.7 ms, Server that takes turns: 670.5 ms and Server that sends in request order: 317.1 ms.

The same Chrome asked the same way every time. Yet from the server that takes turns, the photo took twice as long. Here is Asha's screen 400 ms after she opened the page:

Asha's screen 400 ms after she opened the Mint tea page, from three servers. Follows the priority: the page with the whole photo, and the photo's last byte came at 316.7 ms. Takes turns: the page with an empty space where the photo goes, and the photo's last byte came at 670.5 ms. Request order: the page with the whole photo, and the photo's last byte came at 317.1 ms.Asha's screen, 400 ms after she opened the pageFollows the priorityFollowsThe Mint tea page with the whole photo.photo done: 316.7 msTakes turnsTurnsThe Mint tea page with an empty space where the photo goes.photo done: 670.5 msRequest orderOrderThe Mint tea page with the whole photo.photo done: 317.1 ms
The same page, line and browser, 400 ms in. The server that takes turns had sent a little of every photo, so the big one was still empty.

From the server that takes turns, the photo's space is still empty. That server sent a little of every photo on the page, all at once. So the big photo finished near the end. Why it matters: fetchpriority only changes what Chrome asks for. The server decides whether it happens.

Real-life analogyOne hatch, many plates

A café kitchen has one hatch. Only one plate fits through at a time. The waiter adds a note to each order: "this one first, please". One cook reads the notes. Another hands out a spoonful from every plate in turn, so every table waits for its last spoonful. A third serves the plates in the order they came in.

In real life: The one hatch
In HTTP: The connection: one packet at a time
In real life: The plates waiting to go out
In HTTP: The responses, each in its own stream
In real life: The waiter's note on each order
In HTTP: Chrome's priority signal
In real life: The cook who picks the next plate
In HTTP: The server's scheduler
In real life: A spoonful from every plate in turn
In HTTP: The server that takes turns
The main idea

The browser asks. The server decides. Chrome tells the server how urgent each request is. The server picks whose bytes go into each packet. A server that ignores the signal can undo fetchpriority.

How the course recorded it:

  • The line was Asha's home line from Congestion control: 10 Mbit/s, 20 ms each way, and a router buffer of 512 packets.
  • The server was the example HTTP/3 server of quiche 0.30.1, Cloudflare's QUIC library. It sent with BBR, and paced its packets, as in lesson 43.1.
  • For the other two servers, the course added a few lines to quiche's server. With a setting, it gives every response the same priority, and ignores Chrome's. The next sections explain those priorities.
  • Asha's visits were in Chrome 157.0.8103.52, on a phone-sized screen, over HTTP/3. Chrome's network log, the NetLog, noted when every byte arrived.
  • Each server got three visits, taking turns, after one visit that wasn't kept. The page shows the middle one.

HTTP/2's priority tree, and why it was replaced

How does Chrome ask? There are two ways. The first came with HTTP/2. RFC 7540, the first HTTP/2 standard, let each request say three things:

  • A parent: another request it depends on. Its bytes should come after the parent's.
  • A weight, from 1 to 256: its share of the line, next to requests with the same parent.
  • An exclusive flag: "make me the parent's only child". The parent's other children move under the new request.

Together, these make a tree. The server walks the tree to pick the next bytes. A request with no parent hangs from the root, stream 0. It works like a queue with no line on the floor:

Real-life analogyA queue where everyone names who they follow

At a busy bakery, there's no line on the floor. Each new customer says who they're behind: "I'm after the man in the red coat." Some say "only me after him", and whoever was behind him now stands behind them. The baker keeps the whole queue in her head. If two remarks reach her in the wrong order, her picture of the queue is wrong.

In real life: The person you say you're behind
In HTTP: The parent stream
In real life: "Only me after him"
In HTTP: The exclusive flag
In real life: The baker's picture of the queue
In HTTP: The server's priority tree
In real life: Remarks that reach her in the wrong order
In HTTP: HTTP/3 streams, which can arrive in any order

Chrome builds a very plain tree. Every request is exclusive. Its parent is the newest request that's at least as urgent. Here is a model of that rule. It runs on five requests from the course's priorities page, a page with one of each kind of request:

How Chrome picks each HTTP/2 parentPop out in the code editor (opens in a new tab)JavaScript
// A model of how Chrome 157 picks each HTTP/2 request's parent.// Urgency 0 is the most urgent. `open` holds the requests still loading.const open = [];function parentOf(stream, urgency) {  const ahead = open.filter((item) => item.urgency <= urgency);  ahead.sort((a, b) => a.urgency - b.urgency); // ties keep request order  open.push({ stream, urgency });  return ahead.length ? ahead.at(-1).stream : 0; // 0 is the root} console.log(parentOf(3, 0)); // shop.cssconsole.log(parentOf(5, 1)); // menu.jsconsole.log(parentOf(7, 1)); // mint-tea.jpgconsole.log(parentOf(9, 2)); // black-tea.jpgconsole.log(parentOf(29, 1)); // stock.json
  • Lines 1 and 2 say what the model is. Urgency is a number: 0 is the most urgent.
  • Line 3 keeps every request started so far.
  • Line 5 picks the ones that are at least as urgent as the new one.
  • Line 6 sorts them by urgency. Requests with the same urgency keep the order they started in.
  • Line 8 takes the last one as the parent. With none, the parent is 0, the root.
  • Lines 11 to 15 start five requests. They print 0, 3, 5, 7 and 7.

Look at the last line. stock.json is a fetch() at urgency 1, like the photo. It started after black-tea.jpg, but its parent is the photo, stream 7. It's exclusive, so black-tea.jpg moves under it. The tree stays one long line, one request after another. Chrome's own comment calls it a single linked list.

The course loaded that page in Chrome 157.0.8103.52 over HTTP/2, and read the NetLog. Every request went out exclusive, with the parent the model gives. The weights followed urgency: 256 for urgency 0, 220 for 1, 183 for 2 and 147 for 3. A formula from SPDY, HTTP/2's older cousin, turns each priority into a weight. Here are the five requests, both ways:

Five of the page's requests, two ways. On the left, Chrome's HTTP/2 chain: shop.css (stream 3, weight 256), then menu.js (stream 5, weight 220), then mint-tea.jpg (stream 7, weight 220), then stock.json (stream 29, weight 220), then black-tea.jpg (stream 9, weight 183). Each one's parent is the one above it. On the right, the urgency each one's priority header gave: urgency 0: shop.css; urgency 1: menu.js, mint-tea.jpg, stock.json; urgency 2: black-tea.jpg, and three more images.HTTP/2: who each one followsshop.cssstream 3, weight 256menu.jsstream 5, weight 220mint-tea.jpgstream 7, weight 220stock.jsonstream 29, weight 220black-tea.jpgstream 9, weight 183each one waits for the one aboveThe header: an urgency eachshop.cssurgency 0menu.jsmint-tea.jpgstock.jsonurgency 1black-tea.jpgand 3 more imagesurgency 2a lower number goes first
Over HTTP/2, Chrome lines its requests up in one chain, and each names the one above it as its parent. The header only says how urgent each one is.

The left side is the tree. The right side is the newer way to ask, in the next section: each request only says how urgent it is.

Why the tree was replaced

The tree let a browser say a lot. In practice, it didn't work well. RFC 9113, the current HTTP/2 standard, says the system "proved to be complex, and it was not uniformly implemented." Many servers ignored it. Its summary is short: "the prioritization signaling in RFC 7540 was not successful."

RFC 9218 adds more reasons:

  • Different browsers built very different trees for the same page. So servers struggled to read them.
  • A tree only describes the requests open at that moment, on one connection.
  • HTTP/3 doesn't keep its streams in order. A request can name a parent the server hasn't seen yet, so the tree gets out of step. So HTTP/3 has no tree at all.

RFC 9113 now deprecates the tree. The fields stay in HTTP/2's frames, so old and new programs still understand each other. Chrome 157.0.8103.52 still fills them in on every request. A server can say it ignores them, with a setting called SETTINGS_NO_RFC7540_PRIORITIES. Chrome's own settings don't include it. The NetLog showed the 4 it sent, and that wasn't one of them. Why it matters: an HTTP/2 server gets two signals from Chrome, the tree and the header you'll meet next. Find out which one yours reads.

Extensible priorities: two numbers per request

RFC 9218 replaces the tree with two numbers. A request carries them in a priority header. They don't name any other request. Each request only describes itself:

  • Urgency, u: a whole number from 0 to 7. Lower is more urgent. The default is 3.
  • Incremental, i: whether the file is useful a piece at a time. A photo can show its top half. A script can't run half. The default is no.

The scheme is called extensible priorities, because new parameters can be added later. Think of the slips at a print shop:

Real-life analogyJob slips at a print shop

At a print shop, each job comes with a slip. One box says how urgent it is, from 0 to 7. A tick box says "I can use the pages as they come out". The printer runs the most urgent jobs first. Jobs with the tick can share the printer, a few pages each. Jobs without it print whole, one after another. A blank box means the usual: 3, and no tick.

In real life: The urgency box, 0 to 7
In HTTP: u, the urgency
In real life: The tick box
In HTTP: i, incremental
In real life: Sharing the printer, a few pages each
In HTTP: Incremental responses of one urgency taking turns
In real life: Printing whole, one after another
In HTTP: Responses that aren't incremental, in the order asked
In real life: A box left blank
In HTTP: A missing parameter: it takes its default

The header is a short list: u=1, i means urgency 1, incremental. A part that's missing takes its default. Here is a reader that follows those rules:

Reading a priority headerPop out in the code editor (opens in a new tab)JavaScript
// Reading a priority header the way RFC 9218 says: missing means default.function readPriority(header) {  const priority = { urgency: 3, incremental: false };  for (const part of header.split(",")) {    const [key, value] = part.trim().split("=");    if (key === "u") priority.urgency = Number(value);    if (key === "i") priority.incremental = value !== "?0";  }  return priority;} console.log(readPriority("u=1, i"));console.log(readPriority("i"));console.log(readPriority(""));
  • Line 3 starts from the defaults: urgency 3, not incremental.
  • Line 4 splits the header at each comma. Line 5 splits each part at the equals sign.
  • Line 6 reads the urgency. Line 7 reads incremental. A bare i means true. The format writes false as i=?0.
  • Line 12 prints { urgency: 1, incremental: true }.
  • Line 13 has no urgency, so it keeps the default. It prints { urgency: 3, incremental: true }.
  • Line 14 is an empty header. It prints { urgency: 3, incremental: false }: both defaults.

A server should also ignore any parameter it doesn't know. Why it matters: a request with no header isn't the least important. It sits at urgency 3, in the middle.

What Chrome sends

Chrome adds the header itself, when the request has none. It sends the same header over HTTP/2 and HTTP/3. Each part comes from somewhere:

The course loaded its priorities page over HTTP/3. Read each row across:

What Chrome 157 sent for each kind of request
RequestDevTools showsThe priority header
The page itselfHighestu=0, i: urgency 0, incremental.
The stylesheet, and the font it asks forHighestu=0: urgency 0, not incremental.
The script in the headHighu=1: urgency 1, not incremental.
The photo with fetchpriority="high", and fetch()Highu=1, i: urgency 1, incremental.
The next four large imagesMediumu=2, i: urgency 2, incremental.
Later images, an image with fetchpriority="low", and fetch() with priority: "low"Lowi: urgency 3, the default, incremental.
The async script and the deferred oneLowNo header: urgency 3 and not incremental, both the defaults.

Look at the last row. The async and deferred scripts sent no header at all. Both their numbers are defaults. The rows above show fetchpriority at work. high gave the photo urgency 1. low gave another image urgency 3.

Changing a priority later

A priority can change after a request starts. For that, RFC 9218 adds the PRIORITY_UPDATE frame. It's a short message that says "stream 12 is now u=1". On HTTP/3, it travels on the control stream, a stream for messages about the connection itself.

Chrome 157.0.8103.52 uses it at the start instead. Before each request whose priority isn't the default, it sets the priority, and that sends a PRIORITY_UPDATE. On the priorities page, the NetLog showed 15 updates for 17 requests. Each came just before its own request. The two scripts at the defaults got none. The server logged the same 15.

After layout, Chrome raised 4 images from Medium to High, as How Chromium loads resources showed. DevTools showed the change. But no update followed. Over HTTP/3, a later change stays in Chrome. Over HTTP/2, Chrome's PRIORITY_UPDATE frames are off by default, and the NetLog showed no old-style PRIORITY frames either. Why it matters: the server works with the priority a request started with. To change it, change what Chrome asks for at the start.

Here are the two ways to ask, side by side. Read each row across:

The tree and the header
QuestionThe HTTP/2 treeThe priority header
What a request saysIts parent, its weight, and whether it's exclusive.Its urgency, and whether it's incremental.
What the server must keepThe whole tree of open requests.Two numbers for each request.
Over HTTP/3It isn't there at all.In the header, and in PRIORITY_UPDATE frames.
What Chrome 157 sendsA parent, a weight and the exclusive flag on every HTTP/2 request.The header over HTTP/2 and HTTP/3, unless both numbers are defaults.
Its standardRFC 7540, deprecated by RFC 9113.RFC 9218.

What the server does with two numbers

The header is only a request. RFC 9218 calls it "only a suggestion". But it also says what a good server does with it:

  • Send responses with a higher urgency before those with a lower one.
  • At one urgency, send responses that aren't incremental one by one, in the order they were asked for.
  • At one urgency, share the line between incremental responses.

quiche does just that. Its queue sorts by urgency first. At one urgency, two whole files go in request order. A whole file goes before one that comes in pieces. After each packet of an incremental response, quiche moves it to the back of its group. Here is that queue, in a few lines:

A server's queue, the RFC 9218 wayPop out in the code editor (opens in a new tab)JavaScript
// Each response: its urgency u, whether it's incremental i, and packets left.const queue = [  { name: "black", u: 2, i: true, left: 2 },  { name: "mint", u: 1, i: true, left: 2 },  { name: "green", u: 2, i: true, left: 2 },  { name: "css", u: 0, i: false, left: 2 },];const order = [];while (queue.length) {  queue.sort((a, b) => a.u - b.u || a.i - b.i); // urgency, then whole files first  const next = queue.shift();  order.push(next.name);  next.left -= 1;  if (next.left > 0) next.i ? queue.push(next) : queue.unshift(next);}console.log(order.join(" "));
  • Lines 3 to 6 are four responses. Each needs two packets.
  • Line 10 sorts the queue: lowest urgency first, then whole files before pieces. Equal ones keep their order.
  • Line 11 takes the first response. Line 12 notes its name. Line 13 counts one packet sent.
  • Line 14 puts an unfinished response back. A whole file goes to the front, so it carries on. A file in pieces goes to the back, so it waits its turn.
  • Line 16 prints css css mint mint black green black green.

The stylesheet goes first, whole. Then the photo, alone at urgency 1. Then the two urgency 2 teas take turns. Asha's visit looked just like this. Here is when each photo's bytes arrived, from two of the servers:

When the bytes of each photo on the Mint tea page arrived, in 20 ms steps from 0 to 720 ms, from two servers. Follows the priority: mint-tea.jpg from 120 to 320 ms; black-tea.jpg from 300 to 360 ms and 420 to 560 ms; chamomile.jpg from 300 to 360 ms and 420 to 580 ms; green-tea.jpg from 320 to 360 ms and 420 to 620 ms; hibiscus.jpg from 320 to 360 ms and 420 to 580 ms; jasmine.jpg from 600 to 700 ms; oolong.jpg from 340 to 440 ms; rooibos.jpg from 600 to 720 ms. Takes turns: mint-tea.jpg from 140 to 680 ms; black-tea.jpg from 140 to 260 ms and 280 to 540 ms; chamomile.jpg from 140 to 540 ms; green-tea.jpg from 160 to 660 ms; hibiscus.jpg from 200 to 560 ms; jasmine.jpg from 220 to 540 ms; oolong.jpg from 220 to 240 ms and 260 to 680 ms; rooibos.jpg from 600 to 720 ms.Follows the prioritymint-tea.jpgblack-tea.jpgchamomile.jpggreen-tea.jpghibiscus.jpgjasmine.jpgoolong.jpgrooibos.jpgTakes turnsmint-tea.jpgblack-tea.jpgchamomile.jpggreen-tea.jpghibiscus.jpgjasmine.jpgoolong.jpgrooibos.jpg0 ms360 ms720 ms
Each bar shows when bytes of that photo arrived. Following the priority, the Mint tea photo came first, alone. Taking turns, all eight shared the line.

Following the priority, the Mint tea photo had the line to itself until it was done. The four urgency 2 teas came next, sharing the line. Taking turns, the server gave all eight photos the same urgency, incremental. So each got a packet in turn, and the photo finished second to last. Why it matters: taking turns sounds fair. But a page needs some files whole before others are of any use.

Request order did just as well for the photo, at 317.1 ms. That's because the photo was the first image in the HTML. Request order can't let a later, urgent file jump ahead. The test two sections on shows that.

Slide through Asha's screen, from each server:

Playground: Asha's screen from three servers
The Mint tea page, from three servers
  1. Follows the priorityFollows the priority, the frame Chrome drew at 370 ms.drawn at 370 ms
  2. Takes turnsTakes turns, the frame Chrome drew at 293 ms.drawn at 293 ms
  3. Request orderRequest order, the frame Chrome drew at 388 ms.drawn at 388 ms
Try it yourself
Asha's screen at 400 ms

Move the slider. Each column shows the last frame Chrome drew by then. Watch where the Mint tea photo appears, and how the teas below it fill in.

Real frames from Chrome 157 on a phone screen, over HTTP/3, on the course's emulated home line. From each server, the visit with the middle photo time of three.

Then pick a photo, and see when its bytes arrived from each server:

Playground: when each photo's bytes arrived
mint-tea.jpg0 to 720 ms
  • Follows the priority137.6 to 315.6 ms
  • Takes turns141.5 to 669.5 ms
  • Request order138.8 to 316.8 ms
Try it yourself
Mint tea: priority: u=1, i

Ravi's photo, with fetchpriority="high". Following the priority, it came first and alone. Taking turns, it shared the line with seven other photos. In request order, it came first because Chrome asked for it first.

Chrome 157 over HTTP/3, on the course's emulated home line. Each bar is when Chrome's network log saw this photo's bytes arrive, in 20 ms steps, in the visit kept from each server. Beside it: its first and last byte.

Two photos don't follow the pattern. jasmine.jpg went out at urgency 3, though DevTools later showed High. oolong.jpg went out at urgency 1, like the photo, but came after it. The playground's notes say why, and the next section explains the second one.

What real servers and CDNs do

A server only follows priorities if someone wrote that code. Many didn't. Patrick Meenan wrote on the Cloudflare blog that "a good number of servers don't support doing anything at all with the prioritization". Here is what a few real ones do:

A server can also overrule the browser. RFC 9218 lets a response carry its own priority header, and a CDN in front of it can use that instead. Cloudflare reads it from your origin server or from a Worker. Why it matters: if you know the hero image matters most, your server can say so, whatever the browser asked.

Bytes that have already left

A scheduler only orders the bytes it still holds. Once bytes are handed on, they're out of its hands.

Real-life analogyLetters already in the postbox

You post ten letters in the morning. At noon, an urgent one turns up. You can't take the ten back out of the postbox. The urgent letter goes in on top, and waits for the same van. The fewer you post early, the sooner it can leave.

In real life: The postbox
In the server: A send buffer: bytes handed on, but not sent yet
In real life: The ten letters posted in the morning
In the server: Photo bytes the server already handed on
In real life: The urgent letter
In the server: A late, urgent response
In real life: Posting only a few at a time
In the server: A small send buffer, like tcp_notsent_lowat

For TCP, the operating system holds a send buffer: bytes the server has written but the network hasn't taken yet. Cloudflare's post on tuning HTTP/2 puts it plainly: "Once the response data has been written into the TCP send buffer it is beyond the server's control". Its fix is a small buffer. A Linux setting, tcp_notsent_lowat, set to 16 KB, means "at most 16KB of lower priority data will be buffered" ahead of an urgent response.

QUIC runs inside the server program, so quiche picks the bytes for each packet itself. But quiche only takes as much as the congestion window has room for. When there's no room, quiche's example server keeps the answer aside and tries again later. oolong.jpg fits that rule. Its request left Chrome just after the others, and its first bytes came only after the photo's last, even at urgency 1. Under this rule, an answer that arrives while the room is full waits its turn.

The router's buffer is a postbox too. Congestion control showed CUBIC filling it. Bytes waiting there can't be reordered by anyone. Why it matters: prioritization needs small buffers all along the way. The next section measures that.

Test prioritization yourself

How do you know what your server does? Cloudflare's post sets the goal. An urgent file on a busy connection, with lots of other streams, should come as fast as on an empty one. In the post's words, its time "will be identical to the time to retrieve it on an empty connection." So test exactly that. Start many slow downloads, then ask for one urgent file, late.

Real-life analogyAn ambulance on a busy road

An ambulance sets off on a busy road. If every driver pulls aside, it arrives as fast as on an empty road. If they don't, it crawls along with the traffic. And if a junction ahead is jammed, pulling aside doesn't help. The cars there have nowhere to go.

In real life: The ambulance
In HTTP: The late, urgent request
In real life: The traffic
In HTTP: The photos still downloading
In real life: Drivers pulling aside
In HTTP: A server that sends the urgent bytes first
In real life: The same trip on an empty road
In HTTP: The urgent file on an empty connection
In real life: A jammed junction ahead
In HTTP: Bytes already waiting in the router's buffer

The course's test page shows eight photos, all with fetchpriority="low". After 300 ms, a script asks for late.css, a stylesheet of 20,000 bytes:

The test's late requestJavaScript
setTimeout(() => {  const link = document.createElement("link");  link.rel = "stylesheet";  link.href = "late.css";  link.onload = () => {    const [entry] = performance.getEntriesByName(link.href);    document.querySelector("#result").textContent = `late.css took ${Math.round(entry.responseEnd - entry.startTime)} ms`;  };  document.head.append(link);}, 300);
  • Line 1 waits, while the photos download. Line 10 sets the wait: 300 ms.
  • Lines 2 to 4 make a stylesheet link to late.css.
  • Line 5 runs when the file has loaded. Line 6 reads its Resource Timing entry.
  • Line 7 shows how long it took, from asking to its last byte.
  • Line 9 adds the link to the page. That starts the request.

Here is how long late.css took, the middle of three tests each:

How long late.css took, from the moment Chrome asked for it until its last byte, the middle of three tests each. Empty connection: 106.5 ms. Follows the priority: 105.6 ms. Takes turns: 150.1 ms. Request order: 320.2 ms. Follows it, with CUBIC: 157 ms.late.css, from asking to its last byteEmpty connection106.5 msFollows the priority105.6 msTakes turns150.1 msRequest order320.2 msFollows it, with CUBIC157 ms
Each bar is how long the urgent file took, drawn to scale. From the server that follows the priority, it was as fast as on an empty connection.

Following the priority, late.css took 105.6 ms. On an empty connection, it took 106.5 ms. The goal is met. Taking turns, it took 150.1 ms: it shared the line with the photos. In request order, it took 320.2 ms: it waited behind all eight. Why it matters: a server that passes this test lets a late font or stylesheet through at once.

The last row is the same server, still following priorities, but sending with CUBIC. late.css took 157 ms. The server sent it first. But CUBIC sends more than the line holds, as lesson 43.1 showed. The rest queues in the router's buffer. So late.css waited behind photo bytes that had already left. That's the jammed junction.

Pick a server, and see the bytes:

Playground: one urgent file behind eight photos
Follows the priority0 to 720 ms
  • mint-tea.jpg
  • black-tea.jpg
  • chamomile.jpg
  • green-tea.jpg
  • hibiscus.jpg
  • jasmine.jpg
  • oolong.jpg
  • rooibos.jpg
  • late.css
Chrome asked for late.css
400.3 ms
Its first byte arrived
490.3 ms
Its last byte arrived
505.3 ms
Try it yourself
late.css took 105.6 ms. On an empty connection: 106.5 ms.

The moment late.css arrived, the server sent it ahead of every photo. Its bytes came in one stretch, about as fast as on an empty connection.

The course's priority test in Chrome 157 over HTTP/3, on the emulated home line. Each bar is when Chrome's network log saw a file's bytes arrive, in 20 ms steps. The time is the middle of three tests.

Reading it in a NetLog and a qlog

You can run the same test on your own site, with two logs:

  • In Chrome, open chrome://net-export, record while the page loads, and open the file in the NetLog viewer. For HTTP/3, look at the QUIC session's QUIC_SESSION_STREAM_FRAME_RECEIVED events. Each one names its stream, so you can see whose bytes came when.
  • On the server, a qlog lists every packet sent, and what each one carried. quiche's example server writes one when the QLOGDIR setting names a folder.

Here is the qlog of the server that follows the priority, from one test. It starts just before late.css's request arrived, shortened:

The server's qlog as late.css arrivesJSON
{"time":396.6,"name":"quic:packet_sent","frames":[{"stream_id":20,"length":1324}]}{"time":397,"name":"quic:packet_sent","frames":[{"stream_id":12,"length":1324}]}{"time":397.4,"name":"quic:packet_sent","frames":[{"stream_id":4,"length":1324}]}{"time":397.8,"name":"quic:packet_sent","frames":[{"stream_id":24,"length":108}]}{"time":399.8,"name":"http3:frame_parsed","stream_id":28,"headers":{":path":"/late.css"}}{"time":400.2,"name":"quic:packet_sent","frames":[{"stream_id":28,"length":1321}]}{"time":400.3,"name":"quic:packet_sent","frames":[{"stream_id":28,"length":1326}]}{"time":400.3,"name":"quic:packet_sent","frames":[{"stream_id":28,"length":1326}]}
  • Lines 1 to 4 are packets the server sent. Each carries bytes of a photo: streams 20, 12, 4 and 24.
  • Line 5 is the server reading a request's headers: /late.css, on stream 28.
  • Lines 6 to 8 are the next packets. All of them carry stream 28.

In the full log, every packet after that carried stream 28, until late.css was done. Why it matters: the qlog shows what the server decided. The NetLog shows what arrived. Together, they tell you whether a delay was the server's or the network's.

What a frontend team can change

Chrome and the server do most of this work. But your page decides what Chrome asks for. And you can ask your server team the right questions:

  • Mark what matters. fetchpriority="high" on the hero image gave it urgency 1 instead of 2. That's what let the server send it first.
  • Put it early in the HTML. At the same urgency, request order decides. Request order also saved the photo from the third server.
  • Ask right the first time. Over HTTP/3, a change after layout doesn't reach the server. Don't count on layout to raise a hero image. Mark it.
  • Test your server. Ask for one urgent file behind many slow ones, as above, and compare with an empty connection.
  • Ask about buffers. On TCP, a small tcp_notsent_lowat. On any line, a sender like BBR that keeps the router's buffer short.
  • Ask your CDN. Does it follow RFC 9218? Can you set a priority response header?

Each of these belongs to someone. Sort them by who decides:

Who decides?
  • Sending u=0 with a stylesheet in the head
  • Picking each HTTP/2 request's parent in the chain
  • Sending a PRIORITY_UPDATE frame before a request
  • Asking for the photo at urgency 1 instead of 2
  • Putting the photo's img early in the HTML
  • Choosing which response's bytes go in the next packet
  • Raising the photo's urgency with a priority response header
  • Keeping send buffers small, so urgent bytes can jump ahead
Try it yourself
0 of 8 correct

Sort each job by who does it.

Choose a category for every card. You can change an answer at any time; Reset clears them all.

Common mix-ups

  • "fetchpriority='high' makes the server send the image first." No. It changes what Chrome asks for. The server may ignore it, like the one that takes turns.
  • "A request with no priority header is the least important." No. A missing header means the defaults: urgency 3, not incremental.
  • "HTTP/2 servers use the priority tree." No. Many never did, and RFC 9113 deprecates it. Chrome sends the priority header over HTTP/2 too.
  • "If DevTools shows High, the server knows it's High." No. Over HTTP/3, Chrome 157.0.8103.52 doesn't tell the server about a change after the request has gone.
  • "Taking turns is the fairest order." No. Equal shares made every photo slow, and the most important one finished second to last.
  • "A server that follows priorities is enough." No. Bytes already in a buffer can't be reordered. With CUBIC queueing photo bytes in the router's buffer, late.css took 157 ms instead of 105.6.

Practice exercises

Answer first, then use the hints.

Exercise 1 · Warm-upA header in another order

The reader gets i=?0, u=2. What does it print?

Starter codePop out in the code editor (opens in a new tab)JavaScript
// Reading a priority header the way RFC 9218 says: missing means default.
function readPriority(header) {
  const priority = { urgency: 3, incremental: false };
  for (const part of header.split(",")) {
    const [key, value] = part.trim().split("=");
    if (key === "u") priority.urgency = Number(value);
    if (key === "i") priority.incremental = value !== "?0";
  }
  return priority;
}

console.log(readPriority("i=?0, u=2"));

Answer, then press Check. Spacing and letter case don’t matter.

    Exercise 2 · Warm-upOne more parent

    A sixth request starts: offers.json, at urgency 3. Which stream does the model pick as its parent?

    Starter codePop out in the code editor (opens in a new tab)JavaScript
    // A model of how Chrome 157 picks each HTTP/2 request's parent.
    // Urgency 0 is the most urgent. `open` holds the requests still loading.
    const open = [];
    function parentOf(stream, urgency) {
      const ahead = open.filter((item) => item.urgency <= urgency);
      ahead.sort((a, b) => a.urgency - b.urgency); // ties keep request order
      open.push({ stream, urgency });
      return ahead.length ? ahead.at(-1).stream : 0; // 0 is the root
    }
    
    parentOf(3, 0); // shop.css
    parentOf(5, 1); // menu.js
    parentOf(7, 1); // mint-tea.jpg
    parentOf(9, 2); // black-tea.jpg
    parentOf(29, 1); // stock.json
    console.log(parentOf(31, 3)); // offers.json

    Answer, then press Check. Spacing and letter case don’t matter.

      Exercise 3 · PracticeA font, a script and a photo

      The server's queue holds three responses. What does it print?

      Starter codePop out in the code editor (opens in a new tab)JavaScript
      // Each response: its urgency u, whether it's incremental i, and packets left.
      const queue = [
        { name: "photo", u: 1, i: true, left: 2 },
        { name: "menu", u: 1, i: false, left: 2 },
        { name: "font", u: 0, i: false, left: 1 },
      ];
      const order = [];
      while (queue.length) {
        queue.sort((a, b) => a.u - b.u || a.i - b.i); // urgency, then whole files first
        const next = queue.shift();
        order.push(next.name);
        next.left -= 1;
        if (next.left > 0) next.i ? queue.push(next) : queue.unshift(next);
      }
      console.log(order.join(" "));

      Answer, then press Check. Spacing and letter case don’t matter.

        Exercise 4 · PracticeGreen tea, taking turns

        In the photos playground, pick Green tea. When did its last byte arrive from the server that takes turns, in ms?

        Answer, then press Check. Spacing and letter case don’t matter.

          Exercise 5 · ChallengeThe header on the late request

          In Chrome, open the lesson's copy of the priority test. Which priority header did Chrome send with late.css?

          Answer, then press Check. Spacing and letter case don’t matter.

            Exercise 6 · ChallengeThe queue the wrong way round

            This server sends the card icon first and the stylesheet last. Fix line 10. What does it print then?

            Starter codePop out in the code editor (opens in a new tab)JavaScript
            // Each response: its urgency u, whether it's incremental i, and packets left.
            const queue = [
              { name: "card", u: 3, i: true, left: 1 },
              { name: "css", u: 0, i: false, left: 2 },
              { name: "photo", u: 1, i: true, left: 1 },
            ];
            const order = [];
            while (queue.length) {
              queue.sort((a, b) => b.u - a.u || a.i - b.i); // urgency, then whole files first
              const next = queue.shift();
              order.push(next.name);
              next.left -= 1;
              if (next.left > 0) next.i ? queue.push(next) : queue.unshift(next);
            }
            console.log(order.join(" "));

            Answer, then press Check. Spacing and letter case don’t matter.

              Check your understanding

              For each question, ask who asks, who decides, and where the bytes are waiting.

              The HTTP prioritization quiz · 7 questionsScore: first tries count
              1. Question 1 of 7What does the priority reader print on its second line?

                Read the code, then predictPop out in the code editor (opens in a new tab)JavaScript
                // Reading a priority header the way RFC 9218 says: missing means default.
                function readPriority(header) {
                  const priority = { urgency: 3, incremental: false };
                  for (const part of header.split(",")) {
                    const [key, value] = part.trim().split("=");
                    if (key === "u") priority.urgency = Number(value);
                    if (key === "i") priority.incremental = value !== "?0";
                  }
                  return priority;
                }
                
                console.log(readPriority("u=1, i"));
                console.log(readPriority("i"));
                console.log(readPriority(""));

                Choose an answer to see the explanation.

              2. Question 2 of 7Why does RFC 9113, the current HTTP/2 standard, deprecate the old priority tree?

                Choose an answer to see the explanation.

              3. Question 3 of 7An async script's request carries no priority header at all. What should the server take its priority to be?

                Choose an answer to see the explanation.

              4. Question 4 of 7After layout, DevTools shows an image's priority go from Medium to High. Over HTTP/3, what does Chrome 157 tell the server?

                Choose an answer to see the explanation.

              5. Question 5 of 7From the server that takes turns, why did the Mint tea photo finish about twice as late?

                Choose an answer to see the explanation.

              6. Question 6 of 7In the priority test, late.css took about as long as it did on an empty connection. What does that tell you about the server?

                Choose an answer to see the explanation.

              7. Question 7 of 7The server followed priorities but sent with CUBIC on the big buffer, and late.css took longer. Why?

                Choose an answer to see the explanation.

              Key takeaways

              • The browser only asks. The server picks whose bytes go into each packet.
              • HTTP/2's tree was complex and widely ignored. RFC 9113 deprecates it, though Chrome still sends it.
              • RFC 9218 asks with two numbers: urgency, 0 to 7, default 3, and incremental, default no. Missing means default.
              • Chrome sends the header over HTTP/2 and HTTP/3, from the priority DevTools shows. A later change doesn't reach the server.
              • A good server sends the most urgent first, whole files in order, and shares the line between incremental ones.
              • Test it: one late urgent file on a busy connection should be as fast as on an empty one. Full buffers can still undo it.

              Remember the one-liner.
              Chrome asks with an urgency and a tick box. The server decides, and only for the bytes it still holds.

              Sources

              The facts on this page come from these standards, docs, posts and source files:

              Coming next: QUIC internals. You'll open up the streams this lesson scheduled, and see how QUIC finds and resends a lost packet.

              CompleteFrontend Clear concepts. Working examples.