Skip to content

Instantly share code, notes, and snippets.

@corneliusroemer
Created October 17, 2025 10:16
Show Gist options
  • Save corneliusroemer/1a13722af94d289d4dcc03e6d27cbc7f to your computer and use it in GitHub Desktop.
Save corneliusroemer/1a13722af94d289d4dcc03e6d27cbc7f to your computer and use it in GitHub Desktop.
Load testing script: 10 requests/sec with variable download cancellation points (10KB-100MB)
#!/bin/bash
URL='https://lapis-main.loculus.org/west-nile/sample/alignedNucleotideSequences'
# Define the data limits to test
LIMITS=(10240 102400 1048576 10485760 104857600) # 10KB, 100KB, 1MB, 10MB, 100MB
LIMIT_NAMES=("10KB" "100KB" "1MB" "10MB" "100MB")
echo "Starting requests at 10 requests/second with variable cancellation points"
echo "=========================================================================="
for i in "${!LIMITS[@]}"; do
LIMIT=${LIMITS[$i]}
NAME=${LIMIT_NAMES[$i]}
echo ""
echo "Testing with limit: $NAME ($LIMIT bytes)"
echo "----------------------------------------"
for j in {1..10}; do
echo "Request $j for $NAME..."
# Use curl with --max-filesize to limit download size
# Add timeout and other safety measures
curl -s -S "$URL" \
--max-filesize $LIMIT \
--max-time 30 \
-o /dev/null \
-w "Status: %{http_code}, Downloaded: %{size_download} bytes, Time: %{time_total}s\n" \
2>&1 &
# Wait 0.1 seconds between requests (10 requests/second)
sleep 0.1
done
# Wait for all background jobs from this batch to complete
wait
echo "Completed batch for $NAME"
done
echo ""
echo "All requests completed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment