Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit d3a009f

Browse files
committed
Catch outliers, save raw latency data for debugging
1 parent 5fb9ba8 commit d3a009f

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

metrics/scaling/k8s_scale_nc.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ nc_req_msg_len=${nc_req_msg_len:-1000}
2222
nc_port=33101
2323
# request message
2424
nc_req_msg=$(head -c $nc_req_msg_len /dev/zero | tr '\0' 'x')
25-
nc_percentiles=(5 25 50 75 95)
25+
nc_percentiles=(0 1 5 25 50 75 95 99 100)
2626

2727
pod_command="[\"nc\", \"-lk\", \"-p\", \"${nc_port}\", \"-e\", \"/bin/cat\"]"
2828

@@ -335,6 +335,7 @@ run() {
335335
sleep ${settle_time}
336336

337337
if [[ ${nc_reqs_per_pod} -ge 1 ]]; then
338+
local latency_raw_output="$RESULT_DIR/${TEST_NAME// /-}.t_pods_round_ip_latency_fail_rx.raw"
338339
pod_ips=$(kubectl get pods --selector ${LABEL}=${LABELVALUE} -o json | jq -r '.items[].status.podIP')
339340
if [[ ${reqs} != $(echo $pod_ips | wc -w) ]]; then
340341
info "WARNING: pod IP count mismatch expected ${reqs} found $(echo $pod_ips | wc -w)"
@@ -344,12 +345,17 @@ run() {
344345
local latency_pod_array=()
345346
for latency_round in $(seq ${nc_reqs_per_pod}); do
346347
for pod_ip in ${pod_ips}; do
348+
local latency_failed=0
347349
local latency_pod_start_time=$(date +%s%N)
348-
if [[ $(echo ${nc_req_msg} | nc ${pod_ip} ${nc_port}) != "${nc_req_msg}" ]]; then
350+
local latency_pod_response=$(echo ${nc_req_msg} | nc ${pod_ip} ${nc_port})
351+
local latency_pod_end_time=$(date +%s%N)
352+
local latency_response_microseconds=$(( (latency_pod_end_time - latency_pod_start_time) / 1000 ))
353+
if [[ "$latency_pod_response" != "${nc_req_msg}" ]]; then
349354
latency_failures=$(( latency_failures + 1 ))
355+
latency_failed=1
350356
fi
351-
local latency_pod_end_time=$(date +%s%N)
352-
latency_pod_array+=($(( (latency_pod_end_time - latency_pod_start_time) / 1000000 )))
357+
latency_pod_array+=($latency_response_microseconds)
358+
echo "$latency_pod_start_time $reqs $latency_round $pod_ip $latency_response_microseconds $latency_failed $(echo $latency_pod_response | wc -c)" >> $latency_raw_output
353359
done
354360
done
355361
IFS=$'\n'

0 commit comments

Comments
 (0)