Skip to content

Commit dec8a56

Browse files
[History Server] Tune CPU, memory, and event logging for cold loads (#5095)
* [History Server] Fix cold-load CPU starvation and per-event logging Loading a dead session is CPU-bound, but the sample manifest sets only `limits.cpu: "500m"`, so Kubernetes pins requests there too and the load saturates the quota for its entire duration. Measured on kind across 13 runs, the container sat at 0.42-0.50 cores every time. Raising the limit to 4 (requests stay at 500m, so scheduling cost is unchanged): | tasks in session | 500m | 4 cores | |---|---|---| | 50,000 | 97.9s | 30.5s | | 100,000 | 907.3s | 62.7s | This also removes what looked like superlinear degradation past 50k tasks: at 500m the per-task cost went from 1.96ms to 9.07ms between 50k and 100k, while at 4 cores it is flat (0.61ms and 0.63ms). The load uses ~1.2 cores on average and peaks at ~2.2, because Go's GC runs concurrently and needs cores of its own. The second change drops the per-event log line in storeEvent to Debug. It runs once per event, so a 100k-task session writes ~436,000 INFO lines per cold load, and the binary never calls logrus.SetLevel, so there is no way to turn it off. Worth ~13% of load time at 50k tasks (97.9s -> 85.3s). * historyserver: leave CPU limit configurable Signed-off-by: Future-Outlier <eric901201@gmail.com> * historyserver: size sample memory for session cache Signed-off-by: Future-Outlier <eric901201@gmail.com> * historyserver: repair tests after cache changes Signed-off-by: Future-Outlier <eric901201@gmail.com> * historyserver: size example cache memory Signed-off-by: Future-Outlier <eric901201@gmail.com> * historyserver: document example memory sizing Signed-off-by: Future-Outlier <eric901201@gmail.com> --------- Signed-off-by: Future-Outlier <eric901201@gmail.com>
1 parent b663dc3 commit dec8a56

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

historyserver/config/historyserver-azureblob.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ spec:
4646
- --ray-root-dir=log
4747
ports:
4848
- containerPort: 8080
49+
# Cache is soft-bounded at 8 GiB; 12 GiB leaves decode headroom.
50+
# The 2 GiB request keeps examples schedulable; size production requests to residency.
51+
args:
52+
- --session-cache-max-bytes=8589934592
4953
resources:
50-
limits:
54+
requests:
5155
cpu: "500m"
56+
memory: "2Gi"
57+
limits:
58+
memory: "12Gi"

historyserver/config/historyserver-gcs.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ spec:
4444
imagePullPolicy: IfNotPresent
4545
ports:
4646
- containerPort: 8080
47+
# Cache is soft-bounded at 8 GiB; 12 GiB leaves decode headroom.
48+
# The 2 GiB request keeps examples schedulable; size production requests to residency.
49+
args:
50+
- --session-cache-max-bytes=8589934592
4751
resources:
48-
limits:
52+
requests:
4953
cpu: "500m"
54+
memory: "2Gi"
55+
limits:
56+
memory: "12Gi"

historyserver/config/historyserver.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ spec:
6565
# - --use-auth-token-mode=true
6666
ports:
6767
- containerPort: 8080
68+
# Cache is soft-bounded at 8 GiB; 12 GiB leaves decode headroom.
69+
# The 2 GiB request keeps examples schedulable; size production requests to residency.
70+
args:
71+
- --session-cache-max-bytes=8589934592
6872
resources:
69-
limits:
73+
requests:
7074
cpu: "500m"
75+
memory: "2Gi"
76+
limits:
77+
memory: "12Gi"

historyserver/pkg/eventserver/eventserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (h *EventHandler) storeEvent(clusterSessionKey string, eventMap map[string]
133133
}
134134
eventType := types.EventType(eventTypeStr)
135135

136-
logrus.Infof("current eventType: %v", eventType)
136+
logrus.Debugf("current eventType: %v", eventType)
137137
switch eventType {
138138
case types.TASK_DEFINITION_EVENT:
139139
return h.handleTaskDefinitionEvent(eventMap, clusterSessionKey, false)

0 commit comments

Comments
 (0)