Skip to content

Commit 05ddda2

Browse files
feat(srvless): image size tips (#4865)
* feat(srvless): image size tips * note about cold-starts * Apply suggestions from code review Co-authored-by: Jessica <[email protected]> --------- Co-authored-by: Jessica <[email protected]>
1 parent 25bbb98 commit 05ddda2

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

pages/serverless-containers/faq.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ Ensure that your code avoids heavy computations or long-running initialization a
140140

141141
* **Use sandbox v2**: We recommend you use sandbox v2 (advanced settings) to reduce cold starts.
142142

143+
* **Reduce image size**: Ensure your image is small and clean. [Read our tips for keeping image sizes down](/serverless-containers/reference-content/containers-limitations/#image-size).
144+
143145
### Which Linux syscalls are supported?
144146

145147
- [Sandbox](/serverless-containers/concepts/#sandbox) v1 guarantees full compatibility with Linux syscalls.

pages/serverless-containers/reference-content/containers-limitations.mdx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ This section contains usage limits that apply when using Serverless Containers.
2222
| Containers | Max number | 1000* | Organization |
2323
| Total container memory\** | Max size | 600 GiB | Organization |
2424
| Custom domains | Max number | 50 | Container |
25-
| Image size compressed | Max size | 250 MiB | Container |
26-
| Image size uncompressed | Max size | 1 GiB | Container |
27-
| Temporary disk size | Max size | 1024 MiB | Container |
25+
| Recommended maximum uncompressed image size | Max size | 1 GB | Container |
26+
| Temporary disk size ¨ | Max size | 24 000 MiB | Container |
2827
| Invocation rate | Max number | 1000 per second | Container |
2928
| Concurrency | Max | 80 | Container Instance |
3029
| Max Scale (simultaneous Container instances) | Max | 50 | Container |
@@ -49,6 +48,17 @@ These limits are enforced as [Organization quotas](/organizations-and-projects/a
4948

5049
During the execution of the container, if the limits are exceeded, a restart occurs.
5150

51+
## Image size
52+
53+
We recommend keeping your image size **below 1 GB** to ensure faster deployment and better cold start performances.
54+
55+
### Tips for keeping image size down
56+
57+
* Use lightweight distribution like *Alpine*
58+
* Minimize layers and unnecessary dependencies
59+
* Clean up temp files and cache (e.g., `rm -rf /var/lib/apt/lists/*` in Debian-based images)
60+
* Use multi-stage builds to keep only runtime essentials. [Example](https://github.com/scaleway/serverless-examples/blob/a7a3b5fc3427ec0f1391aaa78957f91af266867c/containers/rust-hello-world/Dockerfile#L14)
61+
5262
## Configuration Restrictions
5363

5464
In order to ensure the proper functioning of the product, we restrict the use of certain ports and environment variables

pages/serverless-jobs/reference-content/jobs-limitations.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,14 @@ In order to ensure the proper functioning of the product, we restrict the use of
6262
## Private Network and Virtual Private Cloud (VPC) compatibility
6363

6464
Refer to the [dedicated FAQ](/serverless-jobs/faq/#how-can-i-configure-access-to-a-private-network-or-virtual-private-cloud-vpc) for more information on Serverless Jobs compatibility with Private Networks and [Virtual Private Cloud (VPC)](/vpc/).
65+
66+
## Image size
67+
68+
We recommend keeping your image size **below 2 GB** to ensure faster deployment.
69+
70+
### Tips for keeping image size down
71+
72+
* Use lightweight distribution like *Alpine*
73+
* Minimize layers and unnecessary dependencies
74+
* Clean up temp files and cache (e.g., `rm -rf /var/lib/apt/lists/*` in Debian-based images)
75+
* Use multi-stage builds to keep only runtime essentials. [Example](https://github.com/scaleway/serverless-examples/blob/a7a3b5fc3427ec0f1391aaa78957f91af266867c/containers/rust-hello-world/Dockerfile#L14)

0 commit comments

Comments
 (0)