Skip to content

Advertisement

DevOps Society
CloudNews

Lambda Now Starts Large Container Images Before It Has Downloaded Them

Lambda Managed Instances can now lazy-load container images with SOCI, which AWS says cuts startup time by up to 70%. How it works, the limits, and how to get the benefit.

Published your local timeupdated

Lambda Now Starts Large Container Images Before It Has Downloaded Them

Container images on Lambda have always had a weight problem. Pack a machine learning framework into an image and it can run to many gigabytes, and the first request waits while all of it is pulled. AWS has now brought a fix it already uses elsewhere to Lambda's newer compute option.

What changed?

Lambda Managed Instances, the option that runs Lambda functions on EC2 capacity you choose, now supports Seekable OCI, or SOCI. AWS's weekly roundup says it fetches only the image files needed at each stage of startup and cuts container startup time by up to 70%. AWS's own tests showed startups of 3 to 11 seconds regardless of image size, against a median of 3 minutes 42 seconds for a 13.2 GB image without it. The same technique now covers SageMaker AI training and processing jobs.

How does SOCI work on Lambda?

According to the Lambda documentation, you create a SOCI index for your image and push it to ECR next to the image. ECR stores an image index that points to both your original image and the SOCI index. You then set the function's image URI to the SOCI-indexed tag and publish a version. Lambda spots the index and lazy-loads the image. Nothing else changes.

Files read during initialisation are fetched then. Files your handler reads for the first time are fetched during that invocation. Lambda does not pull the rest of the image in the background.

What are the limits?

  • Only container image functions on Lambda Managed Instances, not standard Lambda.

  • Only SOCI index manifest v2. The nerdctl image convert --soci command produces it.

  • Single-architecture images only, and the image index must hold exactly two entries: the SOCI index and one image manifest.

  • To change the image or index, push a new SOCI tag and update the function's image URI.

How do you get the most out of it?

  1. Do your imports in init code. This is the one change that matters. If your handler imports a large library on its first call, that call pays the fetch cost and runs long. AWS recommends importing libraries and reading required files during initialisation.

  2. Measure both sides. Compare startup time and the first invocation's duration with and without SOCI. Lazy loading moves cost around as well as removing it.

  3. Put it in the build pipeline. Generate the SOCI tag in CI right after the image build, matching the function's architecture, so nobody has to remember a manual step.

  4. Do not stop trimming images. SOCI helps most when each invocation reads only part of a large image. An image full of files you do read is still slow.

Why it matters

Lambda Managed Instances is AWS's answer for teams that like the Lambda model but need specific instance types, including for inference. Slow starts with big images were one of the reasons to pick ECS or EKS instead. SOCI removes much of that gap, at the cost of one extra build step.

Quick answers

What is SOCI in AWS Lambda?

Seekable OCI (SOCI) lets Lambda Managed Instances start a container image function before the full image is downloaded, fetching files on demand as the code reads them.

How much faster is Lambda with SOCI?

AWS says SOCI cuts container startup time by up to 70%, with its tests showing 3 to 11 seconds of startup regardless of image size, compared with a median of 3 minutes 42 seconds for a 13.2 GB image.

Does SOCI work on standard Lambda functions?

No. SOCI lazy loading is available for container image functions on Lambda Managed Instances only, and it requires a single-architecture image with a SOCI v2 index.

Advertisement

Follow DevOps Society on LinkedIn

Practical infrastructure engineering in your feed.

Follow

Written by

DevOpsSociety Editorial Team

Editorial Team

The DevOpsSociety Editorial Team covers DevOps, cloud infrastructure, Kubernetes, AI infrastructure, platform engineering, cybersecurity, FinOps, and modern engineering practices. We publish practical insights, technical guides, architecture analysis, and research for engineers and technology leaders.

More from DevOpsSociety →
The Infrastructure Briefing

Get the infrastructure briefing.

Practical DevOps, cloud, AI infrastructure and engineering insights, delivered weekly. Read by engineers and engineering leaders.

No spam. Unsubscribe anytime.

Lambda Now Starts Large Container Images Before It Has Downloaded Them, DevOps Society