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

Commit 5f8e922

Browse files
committed
Catch outliers, save raw latency data for debugging
1 parent 9e276b9 commit 5f8e922

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

@@ -339,6 +339,7 @@ run() {
339339
sleep ${settle_time}
340340

341341
if [[ ${nc_reqs_per_pod} -ge 1 ]]; then
342+
local latency_raw_output="$RESULT_DIR/${TEST_NAME// /-}.t_pods_round_ip_latency_fail_rx.raw"
342343
pod_ips=$(kubectl get pods --selector ${LABEL}=${LABELVALUE} -o json | jq -r '.items[].status.podIP')
343344
if [[ ${reqs} != $(echo $pod_ips | wc -w) ]]; then
344345
info "WARNING: pod IP count mismatch expected ${reqs} found $(echo $pod_ips | wc -w)"
@@ -348,12 +349,17 @@ run() {
348349
local latency_pod_array=()
349350
for latency_round in $(seq ${nc_reqs_per_pod}); do
350351
for pod_ip in ${pod_ips}; do
352+
local latency_failed=0
351353
local latency_pod_start_time=$(date +%s%N)
352-
if [[ $(echo ${nc_req_msg} | nc ${pod_ip} ${nc_port}) != "${nc_req_msg}" ]]; then
354+
local latency_pod_response=$(echo ${nc_req_msg} | nc ${pod_ip} ${nc_port})
355+
local latency_pod_end_time=$(date +%s%N)
356+
local latency_response_microseconds=$(( (latency_pod_end_time - latency_pod_start_time) / 1000 ))
357+
if [[ "$latency_pod_response" != "${nc_req_msg}" ]]; then
353358
latency_failures=$(( latency_failures + 1 ))
359+
latency_failed=1
354360
fi
355-
local latency_pod_end_time=$(date +%s%N)
356-
latency_pod_array+=($(( (latency_pod_end_time - latency_pod_start_time) / 1000000 )))
361+
latency_pod_array+=($latency_response_microseconds)
362+
echo "$latency_pod_start_time $reqs $latency_round $pod_ip $latency_response_microseconds $latency_failed $(echo $latency_pod_response | wc -c)" >> $latency_raw_output
357363
done
358364
done
359365
IFS=$'\n'

0 commit comments

Comments
 (0)