diff --git a/stress-get.lua b/stress-get.lua deleted file mode 100644 index 55b57af..0000000 --- a/stress-get.lua +++ /dev/null @@ -1,10 +0,0 @@ --- wrk script for GET stress test --- Reads previously written keys - -counter = 0 - -request = function() - counter = counter + 1 - local key = "/stress-key-" .. (counter % 100 + 1) - return wrk.format("GET", key, nil, nil) -end diff --git a/stress-mixed.lua b/stress-mixed.lua deleted file mode 100644 index 48cb007..0000000 --- a/stress-mixed.lua +++ /dev/null @@ -1,22 +0,0 @@ --- wrk script for mixed workload stress test --- Mix of PUT, GET, and DELETE operations - -counter = 0 - -request = function() - counter = counter + 1 - local op = counter % 10 - local key = "/mixed-key-" .. (counter % 200 + 1) - - if op < 5 then - -- 50% PUTs - local body = "val-" .. counter .. "-" .. string.rep("y", 64) - return wrk.format("PUT", key, nil, body) - elseif op < 9 then - -- 40% GETs - return wrk.format("GET", key, nil, nil) - else - -- 10% DELETEs - return wrk.format("DELETE", key, nil, nil) - end -end diff --git a/stress-put-report.lua b/stress-put-report.lua deleted file mode 100644 index 977fdf8..0000000 --- a/stress-put-report.lua +++ /dev/null @@ -1,27 +0,0 @@ --- wrk script for PUT stress test with response tracking - -counter = 0 -responses = {} - -request = function() - counter = counter + 1 - local key = "/stress-rpt-" .. counter - local body = "value-" .. counter .. "-" .. string.rep("x", 128) - return wrk.format("PUT", key, nil, body) -end - -response = function(status, headers, body) - if responses[status] == nil then - responses[status] = 0 - end - responses[status] = responses[status] + 1 -end - -done = function(summary, latency, requests) - io.write("\n--- Response Status Breakdown ---\n") - for status, count in pairs(responses) do - io.write(string.format(" HTTP %d: %d responses\n", status, count)) - end - io.write(string.format("\n Total errors (connect/read/write/timeout): %d/%d/%d/%d\n", - summary.errors.connect, summary.errors.read, summary.errors.write, summary.errors.timeout)) -end diff --git a/stress-put.lua b/stress-put.lua deleted file mode 100644 index 2a580dd..0000000 --- a/stress-put.lua +++ /dev/null @@ -1,11 +0,0 @@ --- wrk script for PUT stress test --- Each request PUTs a unique key with a small payload - -counter = 0 - -request = function() - counter = counter + 1 - local key = "/stress-key-" .. counter - local body = "value-" .. counter .. "-" .. string.rep("x", 128) - return wrk.format("PUT", key, nil, body) -end diff --git a/stress-test.sh b/stress-test.sh deleted file mode 100644 index c3942ae..0000000 --- a/stress-test.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash -# Comprehensive stress test for ToastyFS HTTP proxy -set -e - -PROXY="http://127.0.0.1:3000" -PASS=0 -FAIL=0 - -pass() { echo " PASS: $1"; PASS=$((PASS + 1)); } -fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); } - -echo "=== ToastyFS Stress Test Suite ===" -echo "" - -# ------------------------------------------------------- -# Test 1: Basic sanity check -# ------------------------------------------------------- -echo "--- Test 1: Basic PUT/GET/DELETE ---" -STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X PUT -d "hello" "$PROXY/sanity-key") -if [ "$STATUS" = "201" ]; then pass "PUT returns 201"; else fail "PUT returned $STATUS instead of 201"; fi - -BODY=$(curl -s "$PROXY/sanity-key") -if [ "$BODY" = "hello" ]; then pass "GET returns correct data"; else fail "GET returned '$BODY' instead of 'hello'"; fi - -STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE "$PROXY/sanity-key") -if [ "$STATUS" = "204" ]; then pass "DELETE returns 204"; else fail "DELETE returned $STATUS instead of 204"; fi - -echo "" - -# ------------------------------------------------------- -# Test 2: wrk PUT stress test with response tracking -# ------------------------------------------------------- -echo "--- Test 2: PUT stress test (4 threads, 16 connections, 10s) ---" -WRK_OUT=$(wrk -t4 -c16 -d10s -s stress-put.lua --timeout 10s "$PROXY" 2>&1) -echo "$WRK_OUT" -echo "" - -TOTAL_REQ=$(echo "$WRK_OUT" | grep "requests in" | awk '{print $1}') -NON_2XX=$(echo "$WRK_OUT" | grep "Non-2xx" | awk '{print $NF}') -if [ -z "$NON_2XX" ]; then NON_2XX=0; fi - -echo " Total requests: $TOTAL_REQ" -echo " Non-2xx responses: $NON_2XX" - -if [ "$NON_2XX" -gt 0 ]; then - fail "Got $NON_2XX error responses during PUT stress test" -else - pass "All PUT requests succeeded" -fi -echo "" - -# ------------------------------------------------------- -# Test 3: Post-stress responsiveness check -# ------------------------------------------------------- -echo "--- Test 3: Post-stress responsiveness ---" -# Immediately try to PUT a key after wrk ends -START=$(date +%s%3N) -STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 -X PUT -d "post-stress" "$PROXY/post-stress-key" 2>&1) -END=$(date +%s%3N) -LATENCY=$((END - START)) - -if [ "$STATUS" = "201" ]; then - pass "Proxy responsive after stress (${LATENCY}ms)" -else - fail "Proxy unresponsive after stress: status=$STATUS latency=${LATENCY}ms" -fi -echo "" - -# ------------------------------------------------------- -# Test 4: High concurrency test (many connections) -# ------------------------------------------------------- -echo "--- Test 4: High concurrency (4 threads, 64 connections, 10s) ---" -WRK_OUT=$(wrk -t4 -c64 -d10s -s stress-put.lua --timeout 10s "$PROXY" 2>&1) -echo "$WRK_OUT" -echo "" - -NON_2XX=$(echo "$WRK_OUT" | grep "Non-2xx" | awk '{print $NF}') -ERRORS=$(echo "$WRK_OUT" | grep -E "Socket errors|connect" || echo "") -if [ -z "$NON_2XX" ]; then NON_2XX=0; fi - -echo " Non-2xx: $NON_2XX" -echo " Socket errors: $ERRORS" - -if [ "$NON_2XX" -gt 0 ]; then - fail "Got $NON_2XX error responses under high concurrency" -else - pass "High concurrency test passed" -fi -echo "" - -# ------------------------------------------------------- -# Test 5: Post-high-concurrency responsiveness -# ------------------------------------------------------- -echo "--- Test 5: Post-high-concurrency responsiveness ---" -START=$(date +%s%3N) -STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 -X PUT -d "post-hc" "$PROXY/post-hc-key" 2>&1) -END=$(date +%s%3N) -LATENCY=$((END - START)) - -if [ "$STATUS" = "201" ]; then - pass "Proxy responsive after high concurrency (${LATENCY}ms)" -else - fail "Proxy unresponsive after high concurrency: status=$STATUS latency=${LATENCY}ms" -fi -echo "" - -# ------------------------------------------------------- -# Test 6: Mixed workload -# ------------------------------------------------------- -echo "--- Test 6: Mixed workload (4 threads, 32 connections, 10s) ---" -# Seed some data first -for i in $(seq 1 50); do - curl -s -o /dev/null -X PUT -d "seed-$i" "$PROXY/mixed-key-$i" -done - -WRK_OUT=$(wrk -t4 -c32 -d10s -s stress-mixed.lua --timeout 10s "$PROXY" 2>&1) -echo "$WRK_OUT" -echo "" - -# ------------------------------------------------------- -# Test 7: GET stress test -# ------------------------------------------------------- -echo "--- Test 7: GET stress test (4 threads, 16 connections, 10s) ---" -# Seed data for GET test -for i in $(seq 1 100); do - curl -s -o /dev/null -X PUT -d "get-test-data-$i" "$PROXY/stress-key-$i" -done - -WRK_OUT=$(wrk -t4 -c16 -d10s -s stress-get.lua --timeout 10s "$PROXY" 2>&1) -echo "$WRK_OUT" -echo "" - -# ------------------------------------------------------- -# Summary -# ------------------------------------------------------- -echo "================================" -echo "Results: $PASS passed, $FAIL failed" -echo "================================"