Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/v2-segment-worker-resources.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The API v2 simulation app's US segment worker (the `SimulationSegmentWorkerUS` class and the plain `run_single_simulation_segment_us` function) requests 1 CPU and 12 GiB instead of 8 CPUs and 32 GiB, about a quarter of the list price per container-second. In production, segments kept about one core busy, and the containers that used the most memory reached 8.6 GiB (each container's 99th percentile).
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
)

SEGMENT_WORKER_RESOURCES: dict[str, Any] = {
"cpu": 8.0,
"memory": 32768,
# A segment calculates one region group in one process, which keeps about
# one core busy; Modal lets a container use free cores beyond its request.
# Memory is a request, not a limit: production segments reached 8.6 GiB in
# a container that calculated several years without a prebuilt year file
# and baseline.
"cpu": 1.0,
"memory": 12288,
"timeout": US_SEGMENT_TIMEOUT_SECONDS,
"retries": 0,
# Every segment of every US simulation call that may run at once: a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ def _expected_worker_options(v2_app) -> dict[str, dict]:
},
"run_single_simulation_segment_us": {
"image": v2_app.us_worker_image,
"cpu": 8.0,
"memory": 32768,
# One region group in one process: about one core busy. In
# production, a container that calculated several years without a
# prebuilt year file and baseline reached 8.6 GiB (its p99).
"cpu": 1.0,
"memory": 12288,
"timeout": 3600,
"retries": 0,
"max_containers": 1000,
Expand Down