Skip to content
Open
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
25 changes: 23 additions & 2 deletions demos/parking/load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,18 @@ 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
for _ in $(seq 1 60); do
Comment thread
bochengchu marked this conversation as resolved.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we more normal style code like this so the meaning is clear

local found=0
if grep -q ... ; then
  found=1
  break
fi

if [[ "${found}" -eq 0 ]]; then
  echo ...
  exit
fi

grep -q "^Proxying " "${TMP}/${a}.proxy.log" 2>/dev/null && break
sleep 0.2
done
if ! grep -q "^Proxying " "${TMP}/${a}.proxy.log" 2>/dev/null; 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() {
Expand All @@ -138,7 +149,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"
Expand All @@ -157,6 +170,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."
Expand Down
8 changes: 6 additions & 2 deletions demos/parking/parking-template.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ containers:
- name: counter
image: ko://go.ate.dev/substrate/demos/counter
command: ["/ko-app/counter"]
# Sandbox size. The pool sets no worker limits, so the worker offers the
# node's allocatable and these only need to fit the node.
wakeupProbe:
httpGet:
path: /readyz
port: 80
# One worker's worth of CPU (see parking.yaml.tmpl), so each worker hosts at
# most one actor at a time.
resources:
limits:
cpuMillicores: 1000
Expand Down
15 changes: 13 additions & 2 deletions demos/parking/parking.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,20 @@ metadata:
labels:
workload: parking
spec:
# Intentionally small: 2 workers, so 3+ concurrently-active actors saturate
# the pool and exercise the parking path.
# Intentionally small: 2 workers, each sized for one actor, so 3+

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get rid of comment changes that don't actually change anything?

# concurrently-active actors saturate the pool and exercise the parking path.
replicas: 2
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
Loading