Advanced Echo Server Logo

Advanced Echo Server

Go-powered testing, load simulation & chaos engineering

Back Pressure Features

Simulate load and test system resilience with rate limiting and chaos error injection. Rate limiting uses a token bucket algorithm; chaos errors introduce random failures.

Control Flow

graph TD
  A[Receive Request] --> B[Rate Limit Check]
  B -->|Within Limit| C{Check Chaos}
  B -->|Exceeds Limit| D[Return 429]
  C -->|X-Echo-Chaos| E[Random Failure]
  C -->|X-Echo-Error| F[Specific Error]
  E -->|Fail| G[Return 500/502/503/504/408]
  E -->|Pass| H[Continue Processing]
  F --> G
  H --> I[Process Request]

Rate Limiting

Control requests-per-second globally via environment variables. Per-request headers are not supported.

# Start server with rate limiting
ECHO_RATE_LIMIT_RPS=10 ECHO_RATE_LIMIT_BURST=20 ./advanced-echo-server

# If limit exceeded:
# HTTP 429 Too Many Requests
# Retry-After: 60

Chaos Errors

Inject random failures with a specified probability (0-100%).

curl -H "X-Echo-Chaos: 30" http://localhost:8080/
# ~30% chance of HTTP 500/502/503/504/408
# Logs: "Chaos error injected: 503"

Specific Error Injection

Force a specific HTTP error code.

curl -H "X-Echo-Error: 503" http://localhost:8080/
# Response: HTTP 503 Service Unavailable
# Logs: "Forced error: 503"

Notes