Enable SOCI lazy loading by default on ECS service modules - #124
Open
mabadir wants to merge 4 commits into
Open
Conversation
Measured on a 168 MiB service, well under the 250 MiB figure AWS suggests as a rule of thumb: image pull dropped 9.42s to 2.21s and task start 46.97s to 24.48s. Small images benefit too, so telling users to turn SOCI off for them was wrong. EC2 capacity remains the real reason to disable it, since those instances have no soci-snapshotter to lazily load with.
# Conflicts: # README.md # compute/ecs_service/rvn-ecs-nlb-definition.yml
Ravion Module Publish PlanDry run only. No Ravion API mutations were made.
Diffsrvn-ecs-nlb 1.1.1 -> 1.2.0--- remote
+++ compiled
label: Git ref (commit or tag)
required: false
type: string
+ soci_enabled: << module.input.soci_enabled >>
source:
base_path: << module.input.source_base_path || "." >>
branch: << build.input.branch >>
@@
- railpack
- nixpacks
type: string_array
+ - collapsible: true
+ default: true
+ description: Build a SOCI-enabled image so Fargate can lazily load it, starting tasks before the full image is downloaded. On by default, and the larger the image the more it saves. Turn it off for EC2 capacity, where the gzip layer compression SOCI requires makes builds slower without speeding up task startup. Lazy loading also changes how long tasks take to report healthy, so services behind a load balancer may need a longer health check grace period.
+ id: soci_enabled
+ label: SOCI lazy loading
+ show_when:
+ build_source:
+ - dockerfile
+ - railpack
+ - nixpacks
+ type: boolean
- id: section_ecr
label: Image registry lifecycle
show_when:
@@
The module is intentionally focused on Layer 4 services behind a Network Load Balancer. Use ECS Web Service for HTTP host and path routing through an Application Load Balancer.
- Terraform source: [ravionhq/modules/compute/ecs_service](https://github.com/ravionhq/modules/tree/rvn-ecs-nlb@1.1.1/compute/ecs_service)
+ Terraform source: [ravionhq/modules/compute/ecs_service](https://github.com/ravionhq/modules/tree/rvn-ecs-nlb@1.2.0/compute/ecs_service)
## Use cases
@@
base_path: compute/ecs_service
branch: main
execution_environment_id: << module.input.execution_environment_id >>
- ref: rvn-ecs-nlb@1.1.1
+ ref: rvn-ecs-nlb@1.2.0
repo: https://github.com/ravionhq/modules
stack_id: <<stack.id>>
terraform_variables:rvn-ecs-web 1.1.0 -> 1.2.0--- remote
+++ compiled
label: Git ref (commit or tag)
required: false
type: string
+ soci_enabled: << module.input.soci_enabled >>
source:
base_path: << module.input.source_base_path || "." >>
branch: << build.input.branch >>
@@
- railpack
- nixpacks
type: string_array
+ - collapsible: true
+ default: true
+ description: Build a SOCI-enabled image so Fargate can lazily load it, starting tasks before the full image is downloaded. On by default, and the larger the image the more it saves. Turn it off for EC2 capacity, where the gzip layer compression SOCI requires makes builds slower without speeding up task startup. Lazy loading also changes how long tasks take to report healthy, so services behind a load balancer may need a longer health check grace period.
+ id: soci_enabled
+ label: SOCI lazy loading
+ show_when:
+ build_source:
+ - dockerfile
+ - railpack
+ - nixpacks
+ type: boolean
- id: section_ecr
label: Image registry lifecycle
show_when:
@@
The module is intentionally focused on web services behind an Application Load Balancer. It uses the selected ECS cluster to inherit AWS account, region, VPC, subnets, capacity providers, load balancer listeners, and load balancer security groups.
- Terraform source: [ravionhq/modules/compute/ecs_service](https://github.com/ravionhq/modules/tree/rvn-ecs-web@1.1.0/compute/ecs_service)
+ Terraform source: [ravionhq/modules/compute/ecs_service](https://github.com/ravionhq/modules/tree/rvn-ecs-web@1.2.0/compute/ecs_service)
## Use cases
@@
base_path: compute/ecs_service
branch: main
execution_environment_id: << module.input.execution_environment_id >>
- ref: rvn-ecs-web@1.1.0
+ ref: rvn-ecs-web@1.2.0
repo: https://github.com/ravionhq/modules
stack_id: <<stack.id>>
terraform_variables:rvn-ecs-worker 1.1.0 -> 1.2.0--- remote
+++ compiled
label: Git ref (commit or tag)
required: false
type: string
+ soci_enabled: << module.input.soci_enabled >>
source:
base_path: << module.input.source_base_path || "." >>
branch: << build.input.branch >>
@@
- railpack
- nixpacks
type: string_array
+ - collapsible: true
+ default: true
+ description: Build a SOCI-enabled image so Fargate can lazily load it, starting tasks before the full image is downloaded. On by default, and the larger the image the more it saves. Turn it off for EC2 capacity, where the gzip layer compression SOCI requires makes builds slower without speeding up task startup. Lazy loading also changes how long tasks take to report healthy, so services behind a load balancer may need a longer health check grace period.
+ id: soci_enabled
+ label: SOCI lazy loading
+ show_when:
+ build_source:
+ - dockerfile
+ - railpack
+ - nixpacks
+ type: boolean
- id: section_ecr
label: Image registry lifecycle
show_when:
@@
The ECS Worker module creates an ECS service for background jobs, queue consumers, event processors, and other private workloads in an existing Ravion ECS cluster. It uses the same ECS service Terraform module as ECS Web Server, but does not create or attach a load balancer target group and does not expose a primary container port.
- Terraform source: [ravionhq/modules/compute/ecs_service](https://github.com/ravionhq/modules/tree/rvn-ecs-worker@1.1.0/compute/ecs_service)
+ Terraform source: [ravionhq/modules/compute/ecs_service](https://github.com/ravionhq/modules/tree/rvn-ecs-worker@1.2.0/compute/ecs_service)
## Use cases
@@
base_path: compute/ecs_service
branch: main
execution_environment_id: << module.input.execution_environment_id >>
- ref: rvn-ecs-worker@1.1.0
+ ref: rvn-ecs-worker@1.2.0
repo: https://github.com/ravionhq/modules
stack_id: <<stack.id>>
terraform_variables: |
flybayer
reviewed
Aug 29, 2026
Comment on lines
+9
to
+19
| - id: soci_enabled | ||
| label: SOCI lazy loading | ||
| type: boolean | ||
| description: Build a SOCI-enabled image so Fargate can lazily load it, starting tasks before the full image is downloaded. On by default, and the larger the image the more it saves. Turn it off for EC2 capacity, where the gzip layer compression SOCI requires makes builds slower without speeding up task startup. Lazy loading also changes how long tasks take to report healthy, so services behind a load balancer may need a longer health check grace period. | ||
| collapsible: true | ||
| show_when: | ||
| build_source: | ||
| - dockerfile | ||
| - railpack | ||
| - nixpacks | ||
| default: true |
Member
There was a problem hiding this comment.
I think we should not expose this control and just enabled for fargate, disable for ec2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
soci_enabledinput to the ECS service modules and turns it on by default, so Fargate can lazily load images and start tasks before the full image finishes downloading.Bumps
rvn-ecs-web,rvn-ecs-worker, andrvn-ecs-nlbto v1.2.0.Scope
The input is declared in
partials/inputs/ecs-service-builder-ecr-misc-inputs.yml, which is included only by the three ECS service definitions.rvn-ec2-service,rvn-lambda, andrvn-aws-staticnever receive it, so they continue to build with zstd compression. (Those modules sharepartials/templates/builder-infrastructure-inputs.yml, which the SOCI partial consumes — the sharing is one-directional, so nothing leaks outward.)Tradeoff
force-compression=true. Every layer is re-encoded each build, making builds slower and images ~20% larger.Measured on a 168 MiB test service (
ravion-test-swr, us-east-2):Verified the deployed image carries
application/vnd.amazon.soci.index.v2+jsonin its ECR manifest on Fargate platform 1.4.0. The SOCI image is larger yet pulls 4x faster, which only happens if lazy loading is active.Turning it off
The description tells users to disable it for small images or EC2 capacity. Note that ECS services using an EC2 capacity provider still get the default, but their container instances have no soci-snapshotter — so they pay the gzip build cost without the startup benefit and should opt out.
Related
Requires the build-side support in ravionhq/flightcontrol#7075 (compression profile,
soci convertstep, digest reporting).Note: this branch is currently 7 commits behind
main(vpc endpoints, module categories) — those touch different files, but worth rebasing before merge.Greptile Summary
Adds a default-enabled SOCI image-building option to the three ECS service modules and releases each module as v1.2.0.
soci_enabledboolean input for source-built ECS images.Confidence Score: 5/5
The PR appears safe to merge with no concrete correctness or security failures identified in the changed repository contracts.
The new input is declared for all three affected ECS modules, each module preserves the shared build object through a valid merge, and each consistently forwards the new setting.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR Input[soci_enabled input<br/>default: true] --> Web[rvn-ecs-web build] Input --> Worker[rvn-ecs-worker build] Input --> NLB[rvn-ecs-nlb build] Web --> Build[Shared ECS image build] Worker --> Build NLB --> Build Build --> ECR[SOCI-enabled image in ECR] ECR --> Fargate[Fargate lazy loading]Reviews (1): Last reviewed commit: "introduce soci" | Re-trigger Greptile
Context used (4)