Instant startup

How fast can a pod start from a large image?

A node usually downloads the full image before a pod starts. With image streaming, the pod starts first, and the node gets each file when a program reads it. We tested each streaming option of containerd on images that hold a dev container and a repository. A pod started in 1 to 7 seconds with each streaming option. A full pull of the 5.4 GB image took 136 seconds.

The answer

136 s → 1 to 7 sTime until the pod runs, large image (5.4 GB). First a full pull, then each streaming option.Median of 4 cold starts for each option. Baseline: containerd with default settings. The pod runs, but its files are not on the node yet.
138 s → 11 to 30 sTime until the work is done, large image. First a full pull, then the five best streaming options.Work: a tool check, then git status and a text search on the repository, then a read of three saved images. The 11 s result uses a file list recorded from this same work.

The time until the work is done is the better number. A pod that runs with no files on the node waits for each file. For the image with many small files (1.9 GB), the best streaming options completed the work in 22 to 37 seconds. A full pull completed it in 68 seconds.

Full pull
The node downloads and unpacks each layer of the image. Then the pod starts.
Streaming
The pod starts after a small download. The node gets a file from the registry when a program reads it. Another name is lazy pull.
File list
A list of the files that the work reads, kept with the image. The node downloads these files first. Another name is prefetch list.
Start
Seconds from the start of the pull until the container runs.
Work done
Seconds from the start of the pull until the last step of the work ends.
Cold start
The node has no part of the image, and its file cache is empty.

Start and work done, side by side

Large image, 5.4 GB. Each option has two bars: the time until the pod runs, and the time until the work is done.

Pod runsWork done
Full pullcontainerd defaults
135.6 s
138.0 s
SOCIlazy, no list
5.8 s
24.8 s
eStargz, optimizedwith a list
12.6 s
26.3 s
overlaybdlazy, no list
4.1 s
23.2 s
Nydus, on demandlazy, no list
2.6 s
21.6 s
Nydus with a file listwith a list
2.4 s
11.4 s

The table adds the image with many small files, and the megabytes that the node downloaded before the pod ran.

OptionMany small files
start
work doneMB before startLarge image
start
work doneMB before startEvidence
Full pullcontainerd defaults50.9 s68.1 s1,915135.6 s138.0 s5,4854 cold startsbaseline
SOCIno file list5.9 s38.9 s2345.8 s24.8 s3444 cold starts
eStargz, optimizedfile list from the converter5.4 s29.8 s28412.6 s26.3 s1,4234 cold startslist is the best case
overlaybdno file list1.5 s37.1 s194.1 s23.2 s464 cold starts
Nydus, on demandno file list, no background download2.1 s35.3 s172.6 s21.6 s234 cold starts
Nydus with a file list1.9 s21.7 s632.4 s11.4 s484 cold startslist is the best case

Times are the median of 4 cold starts. Work for the image with many small files: a tool check, git status and a text search on VS Code, then a Docusaurus site build. The file lists were recorded from this same work. A list from different work matches less well. This page shows 6 of the 15 options. The study records hold the other options, the small image and the second image.

Upfront cost

Each streaming option needs a step in the image build, and a helper program on each node. The helper program has the name snapshotter. Sizes are for the image with many small files. Its source image is 1,895 MB.

OptionImage build stepTime for the stepSize in the registryCan a node with no snapshotter use the image?
Full pullNone0 s1,895 MBsourceYes
SOCIAdd an index. The layers do not change.46 s1,895 MB100%, plus an index of some MBYes. It is the same image.
eStargz, optimizedConvert each layer. Run the work one time to record the list.254 s1,990 MB105%Yes. The layers are valid gzip layers.
overlaybdConvert the image to a block format.67 s3,284 MB173%No. Keep the source image for those nodes.
NydusConvert the image to the Nydus format. The file list is optional.78 s1,877 MB99%No. Keep the source image for those nodes.

Conversion does not make an image much smaller. In the four test images, Nydus was 96% to 102% of the source size, eStargz 102% to 109%, and overlaybd 146% to 179%. The saving is in the megabytes that a node downloads before the work is done.

Tradeoffs

  • SOCI. No change to the image and no second copy. It downloads more before the pod runs than Nydus or overlaybd, because it downloads each small layer in full.
  • eStargz, optimized. Nodes with no snapshotter can use the same image. The conversion is the slowest, and you must run the work in the build to record the list.
  • overlaybd. The fastest start with no file list. The image is 1.5 to 1.8 times larger, and the node needs a kernel module.
  • Nydus, on demand. The smallest download: 9% of the large image when the work was done. Each first read of a file waits for the network.
  • Nydus with a file list. The fastest result in this test. You must record the list and keep it correct when the work changes.
  • Full pull. No setup, and no network wait after the pod runs. The start time increases with the image size.

When streaming loses

  • Many small files and no file list. Plain eStargz completed the work on the image with many small files in 101 seconds. zstd:chunked completed it in 151 seconds. A full pull completed it in 68 seconds. Each small file is one network request.
  • A file list with large files. On the large image, SOCI with a file list started in 13.7 seconds, and SOCI with no list started in 5.8 seconds. The list held large files, thus the node downloaded 1.7 GB before the pod ran.
  • Work that reads most of the image. Streaming saves time only for the files that the work does not read. With default settings, Nydus downloads the full image in the background.
  • The image is on the node already. Each option then starts in 0.2 to 0.3 seconds, with or without streaming.

Parallel pull: a faster full pull?

containerd can download and unpack layers in parallel. SOCI has a parallel mode for a full pull, and zstd layers unpack faster than gzip layers. On the two large images, these settings decreased the full pull time by 3% to 6%. On the two small images, they decreased it by 13% to 37%.

The disk is the limit for the large images. The node disk writes 125 MB each second, and a full pull of the large image writes approximately 17 GB. A faster disk makes a full pull faster. It also makes the difference from streaming smaller.

A second image with the same base layers is a different case. When the node had those layers, a full pull of the second image downloaded 126 MB, not 800 MB, and its pod started in 7.4 seconds, not 22.6 seconds.

What ran

ImageTypeContentsSource size
SmallSmall applicationDev container for Node.js, with the Express repository and its packages653 MB
Many small filesnode_modulesThe same dev container, a Docusaurus site, and the VS Code repository with its packages (approximately 140,000 files)1,895 MB
Second imageShared baseThe same dev container and site, with the TypeScript repository. It shares 22 of 23 layers with the image above.790 MB
LargeLarge tools and large filesThe default Codespaces image, the Kubernetes repository with its history, and three saved container images5,440 MB
  • Images. Built with the dev container CLI, gzip layers, in a registry in the same Region as the nodes (Amazon ECR).
  • Nodes. Two m8i.xlarge nodes (4 vCPUs, 16 GiB), Ubuntu 24.04, gp3 disk with 3,000 operations and 125 MB each second.
  • Software. containerd 2.3.7 with runc 1.5.3. SOCI 0.16.1, stargz 0.19.1, Nydus 2.4.6, overlaybd 1.0.18.
  • Samples. 15 options. For each option and image: 4 cold starts and 1 warm start. 370 measured starts, and each one completed.
  • Proof. Each start recorded the mounts on the node, to show that the option used its own file system. No option changed to a full pull.
  • Left out. Nydus with the kernel cache (fscache): the node kernel does not have the necessary part.
  • Limits. One container runtime (runc), one node type, one disk type. Megabytes after the pod runs include background downloads for eStargz and default Nydus.