Skip to content

Commit c58f374

Browse files
authored
require actor cpu and memory limits (#2285)
We can still consider more flexible overcommit in the future, but I think leaving actors uncapped is unsafe, and it's hard to pick a reasonable universal default, it's too workload dependent. Actor authors should really be aware of how much resources their actor requires, and tuning them can have significant performance impacts. In the future we could do something like determining how much memory was in use at snapshot time and consider that for scheduling resumes. #### Breaking change ActorTemplates *must* declare CPU/memory limits. Previously `microvm` actors had defaulting, and gvisor actors were simply uncapped. This made the scheduler unaware of placement for gvisor. Requiring it also ensures actor owners are aware of how much resources they cost. Setting actor size will be important for performance particularly with microvms where higher memory limits have a real cost for e.g. snapshot/resume.
1 parent f7464d2 commit c58f374

52 files changed

Lines changed: 351 additions & 155 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎benchmarking/nighthawk-egress/traffic-driver-template.yaml.tmpl‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ volumes:
5858
- egress-mitm.ate.dev
5959
- system-roots.ate.dev
6060
path: egress-trust-bundle/trust-bundle.pem
61+
# Sandbox size: headroom so the load generator is not the bottleneck.
62+
resources:
63+
limits:
64+
- name: cpu
65+
quantity: "2"
66+
- name: memory
67+
quantity: 1Gi
6168
sandboxConfig:
6269
sandboxClass: gvisor
6370
configName: gvisor-default

‎benchmarking/workloads/deploy.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ WORKER_COUNT=1
4848
SANDBOX_CLASS="gvisor"
4949
# Actor memory limit (ActorTemplate resources.limits.memory). The default
5050
# is the smallest size microvm admits (128Mi VMM reserve + 128Mi guest floor),
51-
# so benchmark actors do not inherit the 2 GiB kata default and drag its page
52-
# cache into every memory snapshot. Raise it for RAM-consuming suites.
51+
# since a bigger guest drags more page cache into every memory snapshot. Raise
52+
# it for RAM-consuming suites.
5353
ACTOR_MEMORY="256Mi"
5454
# Worker pod memory (WorkerPool spec.template.resources), set as both request
5555
# and limit. Empty leaves the pod unsized. The limit is also the memory the

‎benchmarking/workloads/manifests/glutton-durdir-data-template.yaml.tmpl‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ containers:
4343
volumes:
4444
- name: data
4545
durableDir: {}
46+
# Sandbox size: see the note on the sleep template.
47+
resources:
48+
limits:
49+
- name: cpu
50+
quantity: "1"
51+
- name: memory
52+
quantity: ${ACTOR_MEMORY}
4653
snapshotConfig:
4754
preferredFidelity: SNAPSHOT_FIDELITY_VOLUMES
4855
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-data/

‎benchmarking/workloads/manifests/glutton-durdir-full-template.yaml.tmpl‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ containers:
4040
volumes:
4141
- name: data
4242
durableDir: {}
43+
# Sandbox size: see the note on the sleep template.
44+
resources:
45+
limits:
46+
- name: cpu
47+
quantity: "1"
48+
- name: memory
49+
quantity: ${ACTOR_MEMORY}
4350
snapshotConfig:
4451
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
4552
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-full/

‎benchmarking/workloads/manifests/glutton-storage-template.yaml.tmpl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ containers:
5252
port: 80
5353
resources:
5454
limits:
55+
- name: cpu
56+
quantity: "1"
5557
- name: memory
5658
quantity: ${ACTOR_MEMORY}
5759
snapshotConfig:

‎benchmarking/workloads/manifests/glutton-template.yaml.tmpl‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ containers:
5353
httpGet:
5454
path: /readyz
5555
port: 80
56-
# See the note on the sleep template: unset means the 2 GiB microvm default,
57-
# which the benchmarks should not silently inherit. Raise ${ACTOR_MEMORY}
58-
# for suites that exercise glutton's WriteRAM path.
56+
# See the note on the sleep template. Raise ${ACTOR_MEMORY} for suites that
57+
# exercise glutton's WriteRAM path.
5958
resources:
6059
limits:
60+
- name: cpu
61+
quantity: "1"
6162
- name: memory
6263
quantity: ${ACTOR_MEMORY}
6364
snapshotConfig:

‎benchmarking/workloads/manifests/kernelmem-template.yaml.tmpl‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
# benchmark workload (locust/tests/kernelmem.py): fills kernel memory with
1717
# dentry cache and sleeping processes to size kernel-state snapshots. Not
1818
# part of deploy.sh's default template set; deploy with
19-
# WORKLOAD_TEMPLATES="kernelmem ...". No memory limit: the 50000 sleeping
20-
# processes need more than the 256Mi default --actor-memory the other
21-
# templates take. The sandbox class must match the WorkerPool's so snapshots
22-
# stay within a class.
19+
# WORKLOAD_TEMPLATES="kernelmem ...". Its memory limit is fixed rather than
20+
# --actor-memory: the 50000 sleeping processes need far more than the 256Mi
21+
# default. The sandbox class must match the WorkerPool's so snapshots stay
22+
# within a class.
2323
metadata:
2424
atespace: benchmark-workloads
2525
name: kernelmem
@@ -30,6 +30,14 @@ containers:
3030
- name: kernelmem
3131
image: containerstack/alpine-stress:latest
3232
command: ["sh", "-c", "find /; for i in $(seq 50000); do sleep 10000 & done; sleep 10000"]
33+
# Sandbox size: the 50000 sleeping processes take ~6.3GiB on Linux (~130KB
34+
# each, mostly page tables and kernel state).
35+
resources:
36+
limits:
37+
- name: cpu
38+
quantity: "1"
39+
- name: memory
40+
quantity: 8Gi
3341
snapshotConfig:
3442
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
3543
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/kernelmem/

‎benchmarking/workloads/manifests/sleep-template.yaml.tmpl‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ containers:
2626
- name: sleep
2727
image: busybox@sha256:1487d0af5f52b4ba31c7e465126ee2123fe3f2305d638e7827681e7cf6c83d5e
2828
command: ["/bin/sleep", "1000000"]
29-
# Without a limit a microvm actor gets the kata default 2 GiB guest, and
30-
# anything the guest kernel caches rides along in the memory snapshot —
31-
# bigger guest, bigger snapshot, slower suspend/resume. microvm requires at
32-
# least 256Mi (128Mi VMM reserve + 128Mi guest floor).
29+
# Keep the memory small: anything the micro-VM guest kernel caches rides
30+
# along in the memory snapshot, so a bigger guest means slower
31+
# suspend/resume. microvm requires at least 256Mi (128Mi VMM reserve +
32+
# 128Mi guest floor).
3333
resources:
3434
limits:
35+
- name: cpu
36+
quantity: "1"
3537
- name: memory
3638
quantity: ${ACTOR_MEMORY}
3739
snapshotConfig:

‎benchmarking/workloads/manifests/swebench-astropy-7336-template.yaml.tmpl‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ containers:
4646
env:
4747
- name: SWEPERF_DISABLE_INTERNAL_SLEEP
4848
value: "1"
49+
# Sandbox size: enough for the astropy test runs the trace replays. The cpu
50+
# limit caps the measured execution time, so keep it fixed across runs.
51+
resources:
52+
limits:
53+
- name: cpu
54+
quantity: "2"
55+
- name: memory
56+
quantity: 4Gi
4957
sandboxConfig:
5058
sandboxClass: ${SANDBOX_CLASS}
5159
configName: ${SANDBOX_CONFIG_NAME}

‎benchmarking/workloads/manifests/usermem-template.yaml.tmpl‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# ActorTemplate (protojson-shaped ateapipb.ActorTemplate) for the usermem
1616
# benchmark workload (locust/tests/usermem.py): stress holds 1 GiB of user
1717
# memory to size memory snapshots. Not part of deploy.sh's default template
18-
# set; deploy with WORKLOAD_TEMPLATES="usermem ...". No memory limit: the
19-
# workload allocates 1 GiB, well above the 256Mi default --actor-memory the
20-
# other templates take. The sandbox class must match the WorkerPool's so
18+
# set; deploy with WORKLOAD_TEMPLATES="usermem ...". Its memory limit is
19+
# fixed rather than --actor-memory: the workload allocates 1 GiB, well above
20+
# the 256Mi default. The sandbox class must match the WorkerPool's so
2121
# snapshots stay within a class.
2222
metadata:
2323
atespace: benchmark-workloads
@@ -29,6 +29,13 @@ containers:
2929
- name: usermem
3030
image: containerstack/alpine-stress:latest
3131
command: ["stress", "--vm", "1", "--vm-bytes", "1G", "--vm-keep", "--vm-hang", "0"]
32+
# Sandbox size: the 1 GiB stress allocation plus headroom.
33+
resources:
34+
limits:
35+
- name: cpu
36+
quantity: "1"
37+
- name: memory
38+
quantity: 1536Mi
3239
snapshotConfig:
3340
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
3441
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/usermem/

0 commit comments

Comments
 (0)