Skip to content

Throttle background page loading until the kernel and filesystems are restored #15877

Description

@milantracy

#15721 adds an optional limit (--restore-background-read-rate). The limit applies to the full page load. It protects application page faults after the application starts.

This change is different:

  • It applies only before the application starts.
  • It is automatic for all --background restores. You do not set a rate.
  • It stops when the kernel restore is complete

The two changes can operate together.

Change

For runsc restore --background, runsc starts the loader throttled. When the kernel restore is complete ("MF metadata loaded"), runsc calls Unthrottle(). Then the loader goes back to full parallel reads.

Restores without --background do not change. The fscheckpoint page loader does not change.

Why

With --background, the page loader starts before the kernel decode. It keeps up to 12 reads of 4 MiB in flight. The restore critical path occurs at the same time, and it does small reads on the same disk:

  • The kernel decode reads the state file.
  • The clock update writes the vDSO parameter page. This page is in the checkpoint image, so the write waits for an awaited read.
  • If the runsc and sentry binaries are not in the page cache, each page fault on the binaries is a disk read.

These small reads wait behind the page reads. The application cannot start until the critical path is complete

Benchmark

Setup: master 5f4d54e4a vs. master + #15880. systrap, GCP n2-standard-32 (32 vCPU, 125 GiB), local disk. n=32 for each cell, master and the change in alternate order. Results from benchstat: median ± 95% confidence interval, Mann-Whitney U p-value.

The workload is a Python program that holds N GiB of random data. Each run does a checkpoint and then runsc restore --background. Cache modes:

  • warmbin: the page cache is dropped, then the runsc and sentry binaries are read back (typical busy node).
  • coldbin: the page cache is dropped (new node).
  • hot: the page cache is not dropped.

Metrics:

  • rpc-to-vfs-ms: from the restore RPC to "VFS restored". The application can start after this step.
  • restore-cli-ms: duration of the runsc restore command.
  • pageload-ms: duration of the background page load.
  • app-touch-ms: from the start of runsc restore until the application has read all of its memory.
                   │  master.txt   │              change.txt               │
                   │ rpc-to-vfs-ms │ rpc-to-vfs-ms  vs base                │
Restore/warmbin-2g     62.12 ± 25%      23.58 ± 1%  -62.04% (p=0.000 n=32)
Restore/warmbin-4g     59.11 ± 12%      23.38 ± 1%  -60.44% (p=0.000 n=32)
Restore/coldbin-2g    383.43 ±  6%      38.35 ± 4%  -90.00% (p=0.000 n=32)
Restore/coldbin-4g    363.89 ±  6%      38.35 ± 5%  -89.46% (p=0.000 n=32)
Restore/hot-2g         30.35 ±  6%      23.51 ± 3%  -22.55% (p=0.000 n=32)
geomean                109.2            28.58       -73.84%

                   │   master.txt   │               change.txt               │
                   │ restore-cli-ms │ restore-cli-ms  vs base                │
Restore/warmbin-2g      96.33 ± 14%       54.79 ± 1%  -43.13% (p=0.000 n=32)
Restore/warmbin-4g      94.07 ±  8%       54.71 ± 1%  -41.85% (p=0.000 n=32)
Restore/coldbin-2g      683.3 ±  4%       310.6 ± 4%  -54.54% (p=0.000 n=32)
Restore/coldbin-4g      654.3 ±  5%       315.3 ± 3%  -51.80% (p=0.000 n=32)
Restore/hot-2g          62.02 ±  4%       55.07 ± 2%  -11.21% (p=0.000 n=32)
geomean                 190.6             110.1       -42.23%

                   │ master.txt  │             change.txt             │
                   │ pageload-ms │ pageload-ms  vs base               │
Restore/warmbin-2g   4.764k ± 0%   4.765k ± 0%       ~ (p=0.219 n=32)
Restore/warmbin-4g   9.565k ± 0%   9.565k ± 0%       ~ (p=0.580 n=32)
Restore/coldbin-2g   4.770k ± 0%   4.770k ± 0%   0.00% (p=0.005 n=32)
Restore/coldbin-4g   9.571k ± 0%   9.571k ± 0%       ~ (p=0.234 n=32)
Restore/hot-2g        298.0 ± 2%    310.5 ± 1%  +4.19% (p=0.000 n=32)
geomean              3.618k        3.648k       +0.83%

                   │  master.txt  │             change.txt              │
                   │ app-touch-ms │ app-touch-ms  vs base               │
Restore/warmbin-2g    4.799k ± 0%    4.801k ± 0%       ~ (p=0.714 n=32)
Restore/warmbin-4g    9.599k ± 0%    9.599k ± 0%       ~ (p=0.847 n=32)
Restore/coldbin-2g    5.039k ± 0%    5.047k ± 0%       ~ (p=0.057 n=32)
Restore/coldbin-4g    9.848k ± 0%    9.853k ± 0%       ~ (p=0.367 n=32)
Restore/hot-2g         347.3 ± 1%     360.7 ± 1%  +3.87% (p=0.000 n=32)
geomean               3.801k         3.832k       +0.81%

Summary:

  • The application can start 22–90% earlier, and runsc restore is 11–55% shorter.
  • With a cold image, the page load time and the time until the application reads all of its memory do not change.
  • With a hot page cache, the page load is 12.5 ms longer (+4.2%), because the loader is throttled until the kernel restore is complete. Thus, the application reads all of its memory 13 ms later, although it starts 7 ms earlier.
  • The gain depends on the disk: with a cold image, small critical-path reads wait behind the page reads, so a slower disk gives a larger gain.

Activity

  1. self-assigned this
    on Oct 16, 2026
  2. added 8 commits that reference this issue on Oct 22, 2026
    9272e3b
    39a4579
    0f5a344
    70ac21f
    75f70df
    1dc8010
    8f0ed10
    cfd7907
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions