completefrontend
Open lab My progress
THE WEB PERFORMANCE FIELD GUIDE

How Chromium loads resources

Follow one request through Chrome's source: the preload scanner, how a priority is picked, the network service, and the two schedulers that hold requests back.

By the end, you can
  • 01
    Follow a request through ChromeName each part it passes: the preload scanner, the fetcher that picks its priority, the renderer's scheduler, and the network service.
  • 02
    Say why a request waitedTell tight mode in the renderer from the network service's limits, and say how HTTP/2 and a slow network change them.
  • 03
    Work out a priority from Chrome's rulesApply the type, async, first-five and layout rules, and read one priority under its DevTools, Blink and network names.

One photo's trip through Chrome

Asha opens the Mint tea page on her phone. For a moment, her screen stays blank. Then the heading and a big photo of mint tea appear. The other teas follow below it.

Ravi built the page, and he has read the earlier lessons. He knows what Chrome did. The preload scanner found the photo early. Chrome gave it a priority. Some files waited their turn. Now he has a new question. Who inside Chrome made each of those choices? And where, exactly, can a request wait?

Chrome is built from Chromium, which is open source, so the answer can be read. This lesson follows one request, the photo mint.jpg, through Chrome's own code. Every line it quotes comes from the release the course records with, Chrome 157.0.8103.52. Every number comes from a real visit. Here are four moments from one visit over HTTP/2:

The photo's trip, in four timesPop out in the code editor (opens in a new tab)JavaScript
// One recorded visit to the Mint tea page, in ms after it started.const photo = { found: 37.7, leftRenderer: 39.4, lastByte: 447.5, painted: 680 }; console.log(`Chrome asked for mint.jpg at ${photo.found} ms.`);console.log(`It left the page's renderer at ${photo.leftRenderer} ms.`);console.log(`Its last byte arrived at ${photo.lastByte} ms.`);console.log(`It was painted at ${photo.painted} ms.`);
  • Line 1 is a comment. Every time is in milliseconds (ms) after the visit started.
  • Line 2 holds four times the course recorded for the photo.
  • Lines 4 to 7 print Chrome asked for mint.jpg at 37.7 ms., It left the page's renderer at 39.4 ms., Its last byte arrived at 447.5 ms. and It was painted at 680 ms.

A renderer is the process that runs one page: its HTML, CSS and JavaScript. You met it in Processes and threads. The photo left it less than 2 ms after Chrome asked for it. Then it took about 400 ms to arrive. It was painted later still, because a slow script in the head held the first paint back, as in Render-blocking and parser-blocking resources. Here is the whole trip, next to what Asha saw:

The trip of mint.jpg on one recorded visit. In the page's renderer: the preload scanner finds it at 37.7 ms, the fetcher labels it Medium, and the renderer lets it go at 39.4 ms. In the network service: it is sent at 39.4 ms and its last byte arrives at 447.5 ms. Asha sees it painted at 680 ms. Beside the steps, two real frames of her screen: blank at 31 ms, and the page with the photo at 679 ms.In the page's rendererIn the network serviceOn Asha's screen1. The preload scanner finds it37.7 ms2. The fetcher labels it Medium37.7 ms3. The renderer lets it go39.4 ms4. The network service sends it39.4 ms5. Its last byte arrives447.5 ms6. Asha sees it painted680 ms31 msA blank white screenblank679 msThe top of the Mint tea page: the heading, the mint tea photo, a line of text and the first tea below itthe page
Three steps in the page's renderer, two in the network service, then the paint. The two screens are real frames Chrome captured on this visit. The photo arrived long before it was painted: a slow script in the head held the first paint back.
Real-life analogyA parcel through the post

You leave a parcel in your office's outgoing tray. A clerk spots it and stamps it first class or second class. In the morning rush, the office keeps second-class post back, so the urgent post goes first. Then the parcel goes to the post office, a separate building with its own rules. It sends only a few parcels to one street at a time.

In real life: The address written on the parcel
In Chrome: The tag in the HTML, like <img src="mint.jpg">
In real life: The clerk who spots it in the tray
In Chrome: The preload scanner
In real life: The first-class or second-class stamp
In Chrome: The priority, picked by the ResourceFetcher
In real life: The office holding second-class post in the rush
In Chrome: The renderer's scheduler, in tight mode
In real life: The post office, in another building
In Chrome: The network service, with a scheduler of its own
The main idea

A request is found by the preload scanner and labelled with a priority. Then it may wait twice: once in the page's renderer, and once in the network service. Each of those steps is a few hundred lines of Chrome's code. The sections below read them in the order the photo met them.

Inside the preload scanner

The trip starts with finding the file. HTML parsing and the preload scanner showed what the scanner finds: the files the HTML names. The JavaScript course told the same story from the script's side, in From HTML to running script. Now look at when the scanner runs, and what it reads.

Chrome's HTML parser lives in html_document_parser.cc. Each time a piece of HTML arrives from the network, the parser's Append() function gets it. Here is the part that wakes the scanner. Lines that start with // are comments, and -> calls a function on an object:

When the scanner runs: html_document_parser.cc, lines 1025 to 1034C++
if (preload_scanner_) {  preload_scanner_->AppendToEnd(source);  if (task_runner_state_->GetMode() == kAllowDeferredParsing &&      (IsPaused() || !task_runner_state_->SeenFirstByte())) {    // Should scan and preload if the parser's paused waiting for a resource,    // or if we're starting a document for the first time (we want to at least    // prefetch anything that's in the <head> section).    ScanAndPreload(preload_scanner_.get());  }}

In plain words, line by line:

  1. Line 1: if this page has a preload scanner,
  2. Line 2: hand it the new piece of HTML.
  3. Lines 3 and 4: if the parser is paused, waiting for something such as a script, or if this is the page's first piece,
  4. Lines 5 to 7 are Chrome's own comment. They say why: the scanner should at least look through the head.
  5. Line 8: scan the piece, and start fetching the files it names.

So the scanner runs at two moments: on the first piece of the page, and whenever the parser is stuck. In this release, it runs on the page's main thread, in short bursts. Chrome has code to move it to a thread of its own, but that feature is off by default.

A second reader with its own tokenizer

The scanner doesn't share the parser's work. It has its own tokenizer, the part that cuts HTML into tags. It reads the same bytes again, tag by tag. For each tag, it keeps only the attributes that name a file or change how it's fetched. For an <img>, those include src, srcset, sizes, loading, fetchpriority, and the width and height. It reads <link rel="preload"> tags too, from Resource hints. It also notes a few things on the way:

  • The first <base> tag wins. Every later address is read against it.
  • Anything inside a <template> is skipped: it isn't part of the page yet.
  • An image with loading="lazy" gets no request at all. It waits for layout, like any lazy image.
  • The line and column of each tag are noted. DevTools shows the line as the request's initiator.
Real-life analogyA helper writing a shopping list

A cook is handed a long recipe. A helper reads it once, quickly, and writes a shopping list. For each ingredient, the list says what, how much, and which shop. The helper doesn't cook anything. And when the recipe says "pick the berries later, if there's time", the helper leaves them off the list.

In real life: The recipe
In Chrome: The HTML
In real life: The helper's quick read
In Chrome: The scanner's own tokenizer
In real life: One line of the list: what, how much, which shop
In Chrome: One request: the address, the kind of file, its width and height
In real life: "Pick the berries later, if there's time"
In Chrome: loading="lazy": no request now

Here is the scanner at work on the HTTP/1.1 visit. The whole page, 1,454 bytes, reached the parser in one piece. At 24.3 ms, one scan read all of it. Within the next millisecond, Chrome asked for all 17 files the page names. The parser was held up. It started at line 1, reached menu.js on line 8, and stopped. menu.js is a plain script, and the server took 600 ms to send it. The parser went on at 639.5 ms, and reached the photo's tag at 639.8 ms:

The HTTP/1.1 visit to the Mint tea page, from 0 to 700 ms. The preload scanner reads all 1454 bytes once, at 24.3 ms. The parser starts at 1 ms, stops at line 8 to wait for menu.js, and goes on at 639.5 ms. mint.jpg is asked for at 24.7 ms and arrives by 441.2 ms. The parser reaches the photo's tag at 639.8 ms.preload scannerreads all 1454 bytes at 24.3 msparserstopped at line 8, waiting for menu.jsmint.jpgasked for at 24.7 ms, here by 441 ms639.8 ms: the parser reaches the photo's tag0 ms
The scanner read the whole page in one go, right after it arrived. The parser stopped at line 8 for over 600 ms. By the time it reached the photo's tag, the photo had already arrived.

The scanner asked for the photo 615 ms before the parser reached its tag. Only the parser builds the page, the first step of the critical rendering path. Without the scanner, the photo couldn't have been asked for until then. That's why it matters: on this page, the scanner gave the photo a head start of more than half a second.

One more detail leads to the next section. The scanner passes each image's width and height on with its request. Chrome uses them to pick the request's priority.

How Chrome picks a priority

Every request gets a priority: a label that says how urgent it is. You saw them in How browsers prioritize requests. Chrome picks it in one function, ComputeLoadPriority, in resource_fetcher.cc. Chrome's notes on loading call that file "the core prioritization logic". The function starts from the kind of file:

The starting point: TypeToPriority, shortened from resource_fetcher.cc lines 179 to 199C++
case ResourceType::kCSSStyleSheet:case ResourceType::kFont:  return ResourceLoadPriority::kVeryHigh;case ResourceType::kScript:  return ResourceLoadPriority::kHigh;case ResourceType::kImage:  return ResourceLoadPriority::kLow;

In plain words, line by line:

  1. Lines 1 and 2: a stylesheet or a font
  2. Line 3: starts at kVeryHigh, which DevTools calls Highest.
  3. Lines 4 and 5: a script starts at kHigh, which DevTools calls High.
  4. Lines 6 and 7: an image starts at kLow, which DevTools calls Low.

These names come from Blink, the part of Chrome that runs pages inside the renderer. DevTools shows the same five levels with shorter names.

Then the function changes the starting point, rule by rule, in this order:

  1. An image on the screen goes to High. At first, Chrome doesn't know where an image will be, so this rule only matters later.
  2. An async or defer script drops to Low. A script or stylesheet the scanner found after the first image drops to Medium.
  3. The fetchpriority attribute moves it. high lifts it to at least High. low drops it to Low, or to High for an early stylesheet. A request that blocks rendering is lifted to at least High.
  4. The first five large images the scanner finds go up to Medium. Large means more than 10,000 square pixels. This is where the scanner's width and height come in.
Real-life analogyBoarding groups at an airport gate

At the gate, each ticket shows a boarding group. The kind of ticket decides it. The first few families with small children are moved up a group. A passenger can ask to board early: the staff move them up to group two, but no further. Later, staff may call a few waiting passengers forward. They never send anyone back.

In real life: The group printed on the ticket
In Chrome: The priority from TypeToPriority
In real life: The first few families, moved up a group
In Chrome: The first five large images, raised to Medium
In real life: Asking to board early: group two, no further
In Chrome: fetchpriority="high": High, never Highest
In real life: Calling waiting passengers forward, never back
In Chrome: The update after layout, which only raises

Here are three images from the Mint tea page, through those rules:

Three images on the Mint tea page through Chrome's rules. mint.jpg: its type gives Low; then Medium (1st of 5); after layout Medium (done). jasmine.jpg: its type gives Low; then Low (6th); after layout High (on screen). card.svg: its type gives Low; then Low (small); after layout Low (off screen).the typeline 199first five?line 776after layoutline 594mint.jpgLowMedium: 1st of 5Medium: donejasmine.jpgLowLow: 6thHigh: on screencard.svgLowLow: smallLow: off screen
Every image starts at Low. The first five large ones go up to Medium. After layout, images still loading on the screen go up to High. Shaded: the step that changed the priority.

mint.jpg was the first large image, so it went up to Medium. jasmine.jpg was the sixth: the five places were taken, so it stayed Low. card.svg is a 40 by 24 icon, which is 960 square pixels. That's small, so it didn't count at all.

The update after layout

The bottom row of the picture comes later, after layout: the step where Chrome works out where every element goes. Then Chrome checks every image that's still loading. If one is on the screen, rule 1 gives it High, and Chrome sends the new priority on. On the HTTP/1.1 visit, that happened at 646.4 ms, to six teas at once.

Two rules keep this calm. Images that have already arrived are skipped: mint.jpg had arrived at 441 ms, so it stayed Medium. And a priority only ever goes up. Chrome's comment there says why: so an image that moves in and out of view doesn't keep changing. Try every rule on the page's own files:

Playground: Chrome's rules, one file at a time
resource_fetcher.cc2 rules
  1. line 199TypeToPriority: an image starts at Low. Low
  2. line 776Large image number 1 of the first five: up to Medium. Medium
Try it yourself
mint.jpg, line 14 of the page

The rules give Medium. DevTools recorded Medium at the start, the same. It stayed at Medium: it had already arrived when layout came.

The rules are the parts of resource_fetcher.cc this page uses, rewritten for the lesson. The recorded priorities come from DevTools' network events on the HTTP/1.1 visit.

One priority, three names

Once the priority is picked, it crosses into the network service, which uses the network's own names. Over HTTP/2, Chrome turns it into a priority header on the request, as RFC 9218 defines. Its urgency, u, runs from 0, the most urgent, to 7. The i means the file is useful a piece at a time. The course's server noted the header each request arrived with. Read each row across:

One priority under every name
DevTools showsBlink calls itThe network service calls itThe header the server got
HighestkVeryHighHIGHESTu=0, for shop.css.
HighkHighMEDIUMu=1, for menu.js.
MediumkMediumLOWu=2, i, for mint.jpg.
LowkLowLOWESTi, for card.svg: urgency 3 is the default, so it's left out.
LowestkVeryLowIDLEu=4, by Chrome's rule. This page had no such file.

Notice that the names don't line up. The network's MEDIUM is DevTools' High. Keep that in mind for the network service's rules, two sections from here.

The network service: one door for every tab

The photo now has a priority. But the renderer can't send it. Renderers never talk to the network themselves. One part of Chrome does that for every tab: the network service.

Its README, the notes file at the top of its folder services/network, opens plainly: "This is a service for networking." It says only the lowest level of networking belongs there: "http, sockets, web sockets". Where it runs depends on the device:

The README adds one rule for the code inside: "every PostTask, thread hop and process hop (IPC) should be counted carefully". A hop is a message passed to another thread or process. Each one costs time, so the network service keeps them few.

Real-life analogyA cashier behind glass

At a bank, customers never walk into the vault. They pass a slip through a window to a cashier behind glass. One cashier serves every customer. She decides whose slip goes next, and writes each step in a log book.

In real life: Each customer at the window
In Chrome: Each page's renderer
In real life: The slip passed through the window
In Chrome: A request sent to the network service
In real life: The cashier behind glass
In Chrome: The network service, in a process of its own
In real life: The cashier's log book
In Chrome: The NetLog

Asking before starting

Inside the network service, each request gets a URLLoader, an object that carries it from start to end. Before it sends anything, the loader asks the network service's scheduler whether it may start:

Asking the scheduler: URLLoader::ScheduleStart, shortened from url_loader.cc lines 745 to 757C++
bool defer = false;if (resource_scheduler_client_) {  resource_scheduler_request_handle_->WillStartRequest(&defer);}if (defer)  url_request_->LogBlockedBy("ResourceScheduler");else  url_request_->Start();

In plain words, line by line:

  1. Line 1 makes a flag called defer, "wait", and sets it to false.
  2. Line 2: if this request has a scheduler to ask,
  3. Line 3: ask the scheduler. If the request must wait, the scheduler sets defer to true.
  4. Lines 5 and 6: if it must wait, write "blocked by ResourceScheduler" in the log, and don't start.
  5. Lines 7 and 8: otherwise, start the request now.

A request that waits is started later, when the scheduler calls it back. The next section covers the scheduler's rules.

The network service's own log

Every step of every request goes into the network service's log, the NetLog. You can save one yourself: open chrome://net-export in a new tab, start logging, and load a page in another tab, as Chromium's guide describes. The course started Chrome with the --log-net-log switch instead, which logs from the very start. Pick a request to see its milestones:

Playground: one request in the NetLog
mint.jpg8 milestones
  1. 28 msThe request arrives in the network service. REQUEST_ALIVE BEGIN
  2. 28 msIts job starts. URL_REQUEST_START_JOB BEGIN
  3. 28 msIt looks in the HTTP cache. HTTP_CACHE_GET_BACKEND BEGIN
  4. 28 msIt asks for a connection. HTTP_STREAM_REQUEST BEGIN
  5. 36 msIt gets a connection. HTTP_STREAM_REQUEST END
  6. 36 msIt sends the request. HTTP_TRANSACTION_SEND_REQUEST BEGIN
  7. 440 msThe response's headers arrive. HTTP_TRANSACTION_READ_HEADERS END
  8. 440 msThe last byte is in. The request is done. REQUEST_ALIVE END
Try it yourself
What the log says

The photo went straight through. It arrived at 28 ms, found no reason to wait, and was sent as soon as it had a connection.

Recorded on the HTTP/1.1 visit with Chrome's --log-net-log switch. Times are in ms after the visit started. The plain words are the course's; the event names are the NetLog's own.

mint.jpg went straight through. It arrived, looked in the HTTP cache, got a connection and was sent. card.svg arrived and was blocked at once. So the network service is more than a door: it decides who goes through first.

Two places a request can wait

The course loaded the same page two more ways: over HTTP/1.1, and over HTTP/2 with Chrome told to rate the network as 3G. Same page, same priorities. Here are five files from the HTTP/1.1 visit and the HTTP/2 visit you followed above:

Five files on two recorded visits, from 0 to 1,700 ms. HTTP/1.1: mint.jpg waits in the renderer until 28.4 ms, in the network service until 36.4 ms, and arrives at 441 ms; chamomile.jpg waits in the renderer until 441.4 ms, in the network service until 441.4 ms, and arrives at 853 ms; rooibos.jpg waits in the renderer until 641.4 ms, in the network service until 853.4 ms, and arrives at 1258 ms; card.svg waits in the renderer until 642.4 ms, in the network service until 853.4 ms, and arrives at 1258 ms; points.svg waits in the renderer until 642.4 ms, in the network service until 1259.4 ms, and arrives at 1662 ms. HTTP/2: mint.jpg waits in the renderer until 39.4 ms, in the network service until 39.4 ms, and arrives at 448 ms; chamomile.jpg waits in the renderer until 447.4 ms, in the network service until 448.4 ms, and arrives at 853 ms; rooibos.jpg waits in the renderer until 649.4 ms, in the network service until 650.4 ms, and arrives at 1057 ms; card.svg waits in the renderer until 649.4 ms, in the network service until 650.4 ms, and arrives at 1057 ms; points.svg waits in the renderer until 652.4 ms, in the network service until 653.4 ms, and arrives at 1057 ms.HTTP/1.1mint.jpgchamomile.jpgrooibos.jpgcard.svgpoints.svgHTTP/2mint.jpgchamomile.jpgrooibos.jpgcard.svgpoints.svgwaiting in the rendererwaiting in the network serviceon the network
Same page, same priorities. Over HTTP/1.1, rooibos.jpg, card.svg and points.svg also waited in the network service (shaded). Over HTTP/2, none did. The dashed line is the moment the parser reached <body>.

Most files waited in the renderer, the thin line, for over 600 ms. Over HTTP/1.1, three of them also waited in the network service. Over HTTP/2, none did. Two schedulers made those waits. Take them one at a time.

In the renderer: tight mode

The first is Blink's ResourceLoadScheduler. There's one for each frame: the page, or an iframe inside it. Every page starts in tight mode, the strict phase you met in lesson 5.4. Tight mode ends when the parser inserts the <body> element, which loosens the scheduler. Here are its limits:

The renderer's limits, from resource_load_scheduler.cc lines 37, 40 and 42C++
constexpr size_t kTightLimitForRendererSideResourceScheduler = 2u;constexpr size_t kTightMediumLimitForRendererSideResourceScheduler = 2u;constexpr size_t kLimitForRendererSideResourceScheduler = 1024u;

In plain words, line by line:

  1. Line 1: in tight mode, two requests below High may be running.
  2. Line 2: on top of that, two Medium requests may always run.
  3. Line 3: in normal mode, the limit is 1,024. In practice, that's no limit.

The count on line 1 includes every running request it could throttle, even the High ones. Here is the check as a small model in JavaScript:

Tight mode's check, as a small modelPop out in the code editor (opens in a new tab)JavaScript
// A small model of the renderer's tight-mode check, written for this lesson.function mayStart(priority, running) {  if (priority === "High" || priority === "Highest") return true;  const medium = running.filter((p) => p === "Medium").length;  if (priority === "Medium" && medium < 2) return true;  return running.length < 2;} const running = ["Highest", "High", "Medium", "Medium"]; // shop.css, menu.js, mint.jpg, black.jpgconsole.log(`chamomile.jpg: ${mayStart("Medium", running) ? "starts" : "waits"}`);console.log(`card.svg: ${mayStart("Low", running) ? "starts" : "waits"}`);
  • Line 1 says what this is: a model written for the lesson, not Chrome's own code.
  • Line 3: High and Highest always start. Below High, tight mode's limit applies.
  • Lines 4 and 5: a Medium request starts while fewer than two Medium ones are running.
  • Line 6: anything else starts only while fewer than two requests are running.
  • Line 9 is the moment right after the scan: shop.css, menu.js, mint.jpg and black.jpg were running.
  • Lines 10 and 11 print chamomile.jpg: waits and card.svg: waits.

That's what the recording shows. On the HTTP/1.1 visit, four files left the renderer at once. chamomile.jpg and green.jpg left at 441.4 ms, as soon as mint.jpg and black.jpg had finished. The other eleven left between 639.4 and 642.4 ms, as the parser reached <body>. Not everything waits in tight mode, though: a fetch() is never throttled there.

In the network service: delayable requests

The second scheduler is the network service's ResourceScheduler. It keeps one list for each tab. Its code says so: "Each client represents a tab." It calls some requests delayable: they may be held back. Two lines set who, and how many:

The network service's limits, from resource_scheduler.cc lines 107 and 110C++
static const size_t kMaxNumDelayableRequestsPerHostPerClient = 6;static const net::RequestPriority kDelayablePriorityThreshold = net::MEDIUM;

In plain words, line by line:

  1. Line 1: a delayable request waits while six of its tab's requests are already going to its server.
  2. Line 2: a request below the network's MEDIUM is delayable. That's below DevTools' High: the same line tight mode draws.

A third limit lives in another file: ten delayable requests in all, for each tab. The network service checks every waiting request in ShouldStartRequest. A request starts at once when:

Otherwise, it starts only while the tab has fewer than ten delayable requests going, and fewer than six going to that server. Here is that check as a model too:

The network service's check, as a small modelPop out in the code editor (opens in a new tab)JavaScript
// A small model of the network service's check, written for this lesson.function mayStart(priority, goingToThisServer, server) {  if (priority === "High" || priority === "Highest") return true;  if (server === "HTTP/2") return true;  return goingToThisServer < 6;} console.log(`card.svg over HTTP/1.1: ${mayStart("Low", 6, "HTTP/1.1") ? "starts" : "waits"}`);console.log(`card.svg over HTTP/2: ${mayStart("Low", 6, "HTTP/2") ? "starts" : "waits"}`);console.log(`rooibos.jpg, now High: ${mayStart("High", 6, "HTTP/1.1") ? "starts" : "waits"}`);
  • Line 1 says what this is: a model written for the lesson. It leaves out the limit of ten.
  • Line 3: High and Highest always start.
  • Line 4: an HTTP/2 server orders requests itself, so they start.
  • Line 5: otherwise, a request starts while fewer than six are going to its server.
  • Lines 8 to 10 print card.svg over HTTP/1.1: waits, card.svg over HTTP/2: starts and rooibos.jpg, now High: starts.
Real-life analogyA car park with a barrier

A shopping centre's car park has a barrier. Each shop has six spaces, and the guard lets a car in only when its shop has a free one. Ambulances always drive straight in. A shop with its own loading bay sorts its own visitors, so its cars go in too. But on a stormy day, the guard holds back every car that isn't an ambulance.

In real life: A car waiting at the barrier
In Chrome: A delayable request: below High
In real life: Six spaces for each shop
In Chrome: Six of a tab's requests going to one server
In real life: Ambulances, which always drive in
In Chrome: Requests at High and above
In real life: A shop with its own loading bay
In Chrome: An HTTP/2 or HTTP/3 server, which orders requests itself
In real life: A stormy day
In Chrome: A network Chrome rates 3G or slower

All three lines of the model happened in the recording. Over HTTP/1.1, seven files reached the network service and waited: the six payment icons and rooibos.jpg. rooibos.jpg was let go at 646.4 ms, the moment layout raised it to High. Even then, all six connections to the server were busy, the HTTP/1.1 limit from HTTP/1.1 and HTTP/2. So it waited for a free one until 853.4 ms. The icons went as other requests to the server finished.

Over HTTP/2, nothing waited in the network service. The load event came at 1,065 ms instead of 1,664 ms. That's why it matters: on an HTTP/1.1 server, every file below High queues for six places, however small it is.

When HTTP/2 isn't enough

There's one catch. Chrome keeps estimating how fast the network is, and rates it from slow 2G to 4G. On a network it rates 3G or slower, it holds low requests back even on HTTP/2. That rule is on by default. On those networks, the limit is eight delayable requests, and each request at High or above counts as three of them.

The third visit tested it, with Chrome told to rate the network 3G. HTTP/2 again, yet five of the six icons waited in the network service. The load event came at 1,471 ms. And no request waits forever: after about 30 round trips, but never less than 15 seconds or more than 2 minutes, a waiting request starts anyway.

Here are all three visits, every file. Watch the icons at the bottom as you switch:

Playground: three visits, two places to wait
HTTP/1.17 held in the network service
Try it yourself
HTTP/1.1

The network service held 7 of the page's 17 files: bank.svg until 1,044 ms, card.svg until 852 ms, rooibos.jpg until 646 ms, cash.svg until 1,049 ms, points.svg until 1,257 ms, voucher.svg until 1,049 ms, wallet.svg until 1,048 ms. The load event came at 1,664 ms.

Each row is one file, on one scale from 0 to 1,662 ms. The parser reached <body> at 640 ms on this visit. The number on the right is when the file's last byte arrived.

The two schedulers are easy to mix up. Read each row across: one question, asked of each scheduler.

The renderer's scheduler and the network service's
QuestionThe renderer's ResourceLoadSchedulerThe network service's ResourceScheduler
Where it runsIn the page's renderer, one for each frame.In the network service, one list for each tab.
What it can hold backAnything below High, while the page is in tight mode.Anything below High, on a server that can't order requests itself.
Its limitsTwo at a time below High, plus two Medium places.Six of the tab's requests going to one server, and ten low ones in all.
When it lets goWhen the parser reaches <body>, or a running request ends.When a request ends, or a waiting one's priority goes up.
HTTP/2 and HTTP/3They change nothing here.It lets everything go, unless Chrome rates the network 3G or slower.

So when the Network panel shows a long Queueing time, ask which scheduler made it. If the page was still in its head, it was tight mode: make the head shorter. If many files went to one HTTP/1.1 server, it was the network service. Check what your server speaks, as in Connections in practice, or raise the one file that matters, as in Load the LCP resource early.

Which part of Chrome held it?

Each request below comes from a page like the Mint tea page. Sort it by what held it back, if anything:

Which part of Chrome held it?
  • An async script, while a slow script in the head holds the parser
  • A third Medium photo, found while the parser is still in the head and two Medium photos load
  • A Low icon after <body>, with six requests already going to its HTTP/1.1 server
  • A Low icon over HTTP/2 on a network Chrome rates 3G, while eight other low requests load
  • The stylesheet in the head
  • A fetch() for prices, made by the slow script in the head
  • A photo with fetchpriority="high", found while the parser is still in the head
  • A Low icon over HTTP/2 on a fast network, after <body>
Try it yourself
0 of 8 correct

Sort each request by the scheduler that held it, or by nothing.

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

Common mix-ups

  • "The page's renderer opens its own connections." No. Only the network service talks to the network. It has a process of its own on most platforms, and a thread in the browser process on Android.
  • "Over HTTP/2, Chrome sends every request at once." No. Tight mode still holds requests in the renderer until <body>. And on a network Chrome rates 3G or slower, the network service holds low ones too.
  • "Chrome never has more than six requests going to one server." No. Over HTTP/1.1, six connections set that limit. Over HTTP/2, the recorded visit had thirteen requests going to one server at once.
  • "Layout can lower an image's priority." No. The update after layout only ever raises a priority, and it skips images that have already arrived.
  • "The preload scanner fetches lazy images early, at a low priority." No. It makes no request for an <img loading="lazy"> at all.
  • "DevTools' Medium is the network's MEDIUM." No. The network's MEDIUM is DevTools' High. DevTools' Medium is the network's LOW.

Practice exercises

Answer first, then use the hints.

Exercise 1 · Warm-upA free Medium place

shop.css and mint.jpg have finished, so only menu.js and black.jpg are running. What does the first line print?

Starter codePop out in the code editor (opens in a new tab)JavaScript
// A small model of the renderer's tight-mode check, written for this lesson.
function mayStart(priority, running) {
  if (priority === "High" || priority === "Highest") return true;
  const medium = running.filter((p) => p === "Medium").length;
  if (priority === "Medium" && medium < 2) return true;
  return running.length < 2;
}

const running = ["High", "Medium"]; // menu.js, black.jpg
console.log(`chamomile.jpg: ${mayStart("Medium", running) ? "starts" : "waits"}`);
console.log(`card.svg: ${mayStart("Low", running) ? "starts" : "waits"}`);

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

    Exercise 2 · Warm-upThree going to the server

    This time only three requests are going to the server. What does it print?

    Starter codePop out in the code editor (opens in a new tab)JavaScript
    // A small model of the network service's check, written for this lesson.
    function mayStart(priority, goingToThisServer, server) {
      if (priority === "High" || priority === "Highest") return true;
      if (server === "HTTP/2") return true;
      return goingToThisServer < 6;
    }
    
    console.log(`bank.svg over HTTP/1.1: ${mayStart("Low", 3, "HTTP/1.1") ? "starts" : "waits"}`);

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

      Exercise 3 · PracticeThe last icon

      On the HTTP/1.1 visit, when did the network service let points.svg go, in ms?

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

        Exercise 4 · PracticeWhy reviews.js is Low

        reviews.js is a script, yet it started at Low. Which line of resource_fetcher.cc lowered it?

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

          Exercise 5 · ChallengeThe initiator line

          Open the course's copy of the Mint tea page with DevTools' Network panel open, and reload. What does the Initiator column show for card.svg?

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

            Exercise 6 · ChallengePast both schedulers

            A shop's LCP photo is the seventh large image on its page. The head has a slow script, and the server speaks HTTP/1.1. Which one attribute on the photo's tag gets it past both schedulers?

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

              Check your understanding

              For each question, ask where the request was: in the scanner, in the fetcher, in the renderer's queue, or in the network service.

              The Chromium loading quiz · 8 questionsScore: first tries count
              1. Question 1 of 8What does the second line of the tight-mode model print?

                Read the code, then predictPop out in the code editor (opens in a new tab)JavaScript
                // A small model of the renderer's tight-mode check, written for this lesson.
                function mayStart(priority, running) {
                  if (priority === "High" || priority === "Highest") return true;
                  const medium = running.filter((p) => p === "Medium").length;
                  if (priority === "Medium" && medium < 2) return true;
                  return running.length < 2;
                }
                
                const running = ["Highest", "High", "Medium", "Medium"]; // shop.css, menu.js, mint.jpg, black.jpg
                console.log(`chamomile.jpg: ${mayStart("Medium", running) ? "starts" : "waits"}`);
                console.log(`card.svg: ${mayStart("Low", running) ? "starts" : "waits"}`);

                Choose an answer to see the explanation.

              2. Question 2 of 8In the recordings, why did card.svg wait in the network service over HTTP/1.1, but not over HTTP/2?

                Choose an answer to see the explanation.

              3. Question 3 of 8What ends tight mode in the renderer?

                Choose an answer to see the explanation.

              4. Question 4 of 8Where does Chrome's network service run on Android?

                Choose an answer to see the explanation.

              5. Question 5 of 8DevTools shows a request at High. What does the network service call that priority?

                Choose an answer to see the explanation.

              6. Question 6 of 8After layout, most of the recorded teas went up to High. Why did mint.jpg stay at Medium?

                Choose an answer to see the explanation.

              7. Question 7 of 8What does Chrome's preload scanner do with <img loading="lazy">?

                Choose an answer to see the explanation.

              8. Question 8 of 8Does HTTP/2 stop the network service from holding requests on a network Chrome rates 3G?

                Choose an answer to see the explanation.

              Key takeaways

              • The preload scanner reads the HTML again with its own tokenizer: the first piece at once, later pieces while the parser waits.
              • ComputeLoadPriority picks the priority: the kind of file, then async, fetchpriority and the first five large images. After layout, images on the screen can only go up.
              • The network service sends every request. It runs in a process of its own on most platforms, and on a thread on Android.
              • A request below High can wait twice: in the renderer until <body>, and in the network service when its server can't order requests.
              • HTTP/2 and HTTP/3 end the second wait on fast networks, but not on networks Chrome rates 3G or slower.

              Remember the one-liner.
              Found by the scanner, labelled by the fetcher, then held, maybe twice: by the renderer until <body>, and by the network service.

              Sources

              The facts on this page come from Chromium's own source and docs, at the release the course records with, and these standards:

              Coming next: Inside the rendering engine. Once the files have arrived, Chrome turns them into pixels: style, layout, paint and the compositor, read from the same source.

              CompleteFrontend Clear concepts. Working examples.