diff --git a/demos/parking/load.sh b/demos/parking/load.sh index bf8d6d3f95..c42c0119ff 100755 --- a/demos/parking/load.sh +++ b/demos/parking/load.sh @@ -111,7 +111,22 @@ for i in "${!ACTORS[@]}"; do kubectl ate proxy actor "${a}" "${port}:80" --atespace "${ATESPACE}" >"${TMP}/${a}.proxy.log" 2>&1 & proxy_pids+=($!) done -sleep 3 +# Wait for each proxy to print its "Proxying ..." ready line before sending load. +for a in "${ACTORS[@]}"; do + found=0 + for _ in $(seq 1 60); do + if grep -q "^Proxying " "${TMP}/${a}.proxy.log" 2>/dev/null; then + found=1 + break + fi + sleep 0.2 + done + if [[ "${found}" -eq 0 ]]; then + echo " proxy for ${a} failed to start:" >&2 + cat "${TMP}/${a}.proxy.log" >&2 || true + exit 1 + fi +done # One worker per actor: hammer it with request->suspend until the deadline. worker() { @@ -138,7 +153,9 @@ wait "${pids[@]}" # ---- aggregate ------------------------------------------------------------- echo echo "==> results" -cat "${TMP}"/*.log 2>/dev/null >"${TMP}/all" || true +for a in "${ACTORS[@]}"; do + cat "${TMP}/${a}.log" 2>/dev/null || true +done >"${TMP}/all" total=$(wc -l <"${TMP}/all" | tr -d ' ') if [[ "${total}" -eq 0 ]]; then echo " no responses recorded -- check proxy logs" @@ -157,6 +174,14 @@ printf " 503 unavailable: %s\n" "${busy}" printf " other : %s\n" "${other}" printf " 200 latency : avg %ss, slowest %ss <- parked requests sit here\n" "${avg_ok}" "${slowest_ok:-n/a}" echo +if [[ "${other}" -gt 0 ]]; then + echo " => ${other} requests failed with a non-200/503 status." + exit 1 +fi +if [[ "${ok}" -eq 0 ]]; then + echo " => 0 requests succeeded (${busy} shed with 503)." + exit 1 +fi if [[ "${busy}" -eq 0 ]]; then echo " => 0 failures under saturation: parking absorbed the contention." echo " Re-run with the router started --parked-request-max=0 to see 503s." diff --git a/demos/parking/parking-template.yaml.tmpl b/demos/parking/parking-template.yaml.tmpl index 4753f7a02a..8aedaa450a 100644 --- a/demos/parking/parking-template.yaml.tmpl +++ b/demos/parking/parking-template.yaml.tmpl @@ -26,6 +26,10 @@ containers: - name: counter image: ko://go.ate.dev/substrate/demos/counter command: ["/ko-app/counter"] + wakeupProbe: + httpGet: + path: /readyz + port: 80 # Sandbox size. The pool sets no worker limits, so the worker offers the # node's allocatable and these only need to fit the node. resources: diff --git a/demos/parking/parking.yaml.tmpl b/demos/parking/parking.yaml.tmpl index b8a5cb3f58..19387887af 100644 --- a/demos/parking/parking.yaml.tmpl +++ b/demos/parking/parking.yaml.tmpl @@ -46,3 +46,14 @@ spec: workerImage: ko://go.ate.dev/substrate/cmd/ateworker-gvisor sandboxClasses: - name: gvisor + template: + # Each worker advertises its container limits as capacity. Sizing CPU to + # one actor's limit in parking-template.yaml.tmpl caps each worker at one + # running actor. + resources: + limits: + cpu: "1" + memory: 1Gi + requests: + cpu: 250m + memory: 1Gi