-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFremiumFlow
More file actions
213 lines (147 loc) · 9.77 KB
/
Copy pathFremiumFlow
File metadata and controls
213 lines (147 loc) · 9.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
Freemium flow suggestion (inspired by the Vercel vs Render Docker comparison)
Core positioning
• Free tier: Ideal for HTTP-centric, bursty, or prototype workloads that benefit from scale-to-zero and Active CPU billing (Vercel-style).
• Paid tiers: Unlock always-on instances, background workers, cron jobs, persistent disks, higher limits, and predictable per-instance pricing (Render-style).
Suggested freemium user journey
1. Sign-up / onboarding (Free)
◦ One-click “Deploy from Dockerfile” or “Push pre-built image”.
◦ Instant preview deployment with unique URL for every commit/PR.
◦ Automatic build (Dockerfile.vercel / Containerfile.vercel or standard Dockerfile).
◦ Runs as an HTTP-only function that scales to zero.
◦ Limits: modest concurrent requests, short max duration, no persistent disk, no background workers/cron, shared networking.
2. Activation / first value (Free)
◦ Live preview URL + basic observability (logs, request metrics).
◦ Auto-generated env vars for multi-service projects.
◦ CDN + edge routing in front of the container.
◦ Clear in-dashboard banner: “Your container is currently free while idle. Upgrade for always-on, workers, disks, or higher limits.”
3. Usage-based free → paid conversion triggers
◦ Traffic exceeds free Active-CPU / request quota.
◦ User tries to add a background worker, cron job, or private service.
◦ User attaches a persistent disk or needs zero-downtime deploys with state.
◦ User hits cold-start sensitivity or wants fixed instance sizing / predictable billing.
◦ WebSocket connections that need longer-lived sessions without reconnect handling.
4. Upgrade paths (clear, non-intrusive)
◦ Starter / Pro (pay-as-you-go Active CPU or small always-on instances)
▪ Higher concurrency & duration limits.
▪ Manual or basic autoscaling.
▪ Private networking.
◦ Business / Scale
▪ Full always-on instances with CPU/memory autoscaling.
▪ Background workers + cron jobs.
▪ Persistent disks (with the known trade-offs of no horizontal scale + brief deploy downtime).
▪ Custom domains, zero-downtime deploys (when no disk), deploy hooks, Blueprints/IaC.
◦ Optional hybrid: keep the HTTP API/frontend on the scale-to-zero free/cheap tier and move workers or stateful services to the always-on paid tier.
5. Retention & expansion loops
◦ Free preview environments stay available forever for every commit (strong developer experience).
◦ Dashboard shows projected cost under both models (“If this traffic ran always-on vs Active CPU”).
◦ One-click migration helpers between the two compute models.
◦ Marketplace integrations for databases/queues so free users never need local state.
Pricing psychology alignment
• Free tier leans hard into Vercel’s model (pay only for actual execution, scale to zero, previews for every commit).
• Paid tiers lean into Render’s strengths (always-on, non-HTTP workloads, disks, predictable instance pricing).
• Most teams will start free on HTTP containers and graduate when they need workers, disks, or steady load.
This flow maximizes free-user acquisition and developer delight while creating natural, high-intent upgrade moments exactly where the two platforms’ strengths diverge.
https://grok.com/share/c2hhcmQtMg_760a997f-1b2e-422b-9d6d-d863991bedd9
Vercel Container Registry (VCR) optimization focuses on making container images boot as fast as possible on Fluid compute (for both Vercel Functions and Vercel Sandbox).
Core optimization mechanism
When you push an image to vcr.vercel.com, VCR automatically optimizes it in the background:
• It converts the OCI image into a precompiled / optimized snapshot (using the same format as Sandbox Snapshots / VHS – Vercel Hive Snapshot).
• This snapshot is tuned specifically for Fluid compute.
• On boot, Vercel streams the snapshot and decompresses it on demand rather than downloading the entire image first.
• Result: the container can start handling requests before the full image is fully downloaded and decompressed. Larger images do not force a full wait.
This is the main reason cold starts are significantly better than a traditional registry + container runtime pull.
Recommended build practices for maximum optimization
Vercel strongly recommends building with Docker Buildx + zstd compression:
bash
docker buildx build \
--platform linux/amd64,linux/arm64 \
--output "type=image,name=vcr.vercel.com/team-slug/project-slug/my-repository:latest,push=true,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true"
Why this helps:
• zstd produces smaller layers than gzip and enables faster snapshot creation/boots.
• Multi-platform builds (amd64 + arm64) are supported in one step.
• force-compression=true ensures every layer is compressed.
• Only gzip or zstd layers are accepted; uncompressed layers are rejected.
Other best practices:
• Use immutable tags (e.g. commit SHA) for production; reserve :latest for local iteration.
• Prefer pushing from the Vercel build environment (it is already authenticated for the project).
• Keep individual compressed layers ≤ 500 MB and total image size ≤ 15 GB.
Limits & pricing that affect optimization
Resource
Limit
Compressed layer
500 MB
Total image size
15 GB
Manifest body
4 MB
Image config blob
1 MB
Storage price
$0.10 / GB
Plan limits (repositories / images / tags) scale from Hobby → Pro → Enterprise.
How it ties into Fluid compute
• Containers run as Vercel Functions on Fluid compute → scale to zero, Active CPU pricing, optimized concurrency.
• The optimized snapshot + streaming decompression + Fluid’s instance reuse / pre-warming combine to keep cold starts low.
• For Sandbox: the image must be ready (optimized) before Sandbox.create() succeeds; check the readiness status on the repository page if you hit image_not_ready.
Practical takeaway
1. Always push with zstd via Buildx.
2. Let VCR do the background snapshot optimization.
3. Rely on the streaming boot model + Fluid compute for fast starts and scale-to-zero economics.
This combination is what makes Docker-on-Vercel feel much closer to a traditional always-on server while still giving you the cost and operational benefits of serverless.
INVESTIGATE ZSTDCOMPRESSION BENEFITS skill-creator skill
───
name: zstd-compression
description: Investigate and apply Zstandard (zstd) compression benefits for container images, Docker builds, registries, and general data. Use when optimizing image size, pull/startup time, Vercel Container Registry, Buildx, or comparing gzip vs zstd.
Zstd Compression Benefits
Zstandard (zstd) is a modern lossless compression algorithm from Meta. Prefer it over gzip for container image layers, registries, and most archival/transfer workloads in 2026.
Key Benefits vs Gzip
• Better compression ratio — typically 10–50% smaller layers (20–30% common on real Docker images). Larger images (ML, data, Jupyter) see the biggest gains.
• Much faster decompression — often 50–60% faster than pigz and 2–10× faster than single-threaded gzip. Critical for container cold starts and image pulls.
• Competitive or faster compression — multi-threaded by default; can be 5–10× faster than classic gzip while still producing smaller output.
• Tunable levels — level 3 (default) balances speed/size; higher levels (9–19) trade build time for extra size reduction. Decompression speed stays high across levels.
• Native multi-threading and modern entropy coding (Huff0 + FSE).
Real-world container numbers:
• AWS Fargate — up to 27% faster task/pod startup.
• Depot benchmarks — ~60% faster decompression, smaller files than gzip.
• Home Assistant / Immich examples — 18–49% smaller images depending on content and level.
• Byteplus registry tests — roughly half the end-to-end pull time on multi-GB images.
When to Prefer zstd
• Container images pushed to modern registries (Vercel Container Registry, ECR, GHCR, etc.).
• Any workload where pull + decompress time dominates cold start (Kubernetes, Fargate, serverless containers, Vercel Fluid compute).
• Network-bound transfers and long-term storage of compressible data.
• Build pipelines that already use BuildKit / Buildx.
Prefer gzip only when you need maximum compatibility with very old Docker clients (<23) or extremely low-CPU compression environments.
Recommended Buildx Invocation (Containers)
bash
docker buildx build \
--platform linux/amd64,linux/arm64 \
--output "type=image,name=IMAGE_REF,push=true,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true" \
.
• compression=zstd — enable zstd layers.
• compression-level=3 — good default (Vercel recommendation). Raise to 9 for extra size savings if build time is acceptable.
• force-compression=true — recompress every layer.
• oci-mediatypes=true — produce proper OCI media types.
Vercel Container Registry explicitly recommends this form; it produces smaller layers that convert faster into the optimized Fluid-compute snapshots.
Compatibility Notes
• Supported by containerd, modern Docker (23+), BuildKit, Podman, CRI-O, most cloud registries.
• VCR accepts gzip or zstd only (uncompressed layers rejected).
• For maximum backward compatibility some pipelines publish dual gzip + zstd variants with gzip listed first in the index.
Quick Decision Guide
Goal
Choice
Level
Fastest practical builds + good size
zstd
3
Smallest images
zstd
9–15
Legacy Docker clients only
gzip
6–9
Extreme archival ratio
xz or zstd-19+
high
Related Vercel / Registry Context
When pushing to Vercel Container Registry the zstd layers feed directly into the background “precompiled snapshot” optimization used by Fluid compute and Sandbox. Smaller, faster-to-decompress layers translate into quicker scale-from-zero boots.
For further deep dives load references/ files if present.