Load Testing

Relay Cloud includes a built-in load testing tool so you can benchmark your app's throughput and connection limits without external tooling.

Running a Load Test

Open your app dashboard and navigate to Load Testing. Configure the test parameters:

  • Concurrent connections — number of simulated WebSocket clients (up to 10,000)
  • Events per second — target publish rate
  • Duration — how long the test runs (max 5 minutes)
  • Channel pattern — which channels to subscribe and publish to

Click Start Test to begin. Results stream in real-time.

Test Scenarios

Choose from built-in scenarios or define a custom one:

Fan-out

One publisher, many subscribers. Tests how quickly events reach a large audience.

{
    "scenario": "fan-out",
    "subscribers": 5000,
    "publishers": 1,
    "events_per_second": 100,
    "duration_seconds": 60,
    "channel": "benchmark-fanout"
}

Many-to-many

Multiple publishers and subscribers on the same channel. Simulates a chat room.

{
    "scenario": "many-to-many",
    "subscribers": 1000,
    "publishers": 200,
    "events_per_second": 50,
    "duration_seconds": 120,
    "channel": "benchmark-chat"
}

Connection storm

Ramps up connections rapidly to test connection handling under pressure.

{
    "scenario": "connection-storm",
    "target_connections": 10000,
    "ramp_seconds": 30,
    "hold_seconds": 60
}

Running via API

curl -X POST https://your-relay-host.com/api/v1/apps/YOUR_APP_ID/load-tests \
  -H "Authorization: Bearer YOUR_APP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scenario": "fan-out",
    "subscribers": 2000,
    "publishers": 1,
    "events_per_second": 100,
    "duration_seconds": 60,
    "channel": "benchmark"
  }'

Poll for results:

curl https://your-relay-host.com/api/v1/apps/YOUR_APP_ID/load-tests/lt_abc123 \
  -H "Authorization: Bearer YOUR_APP_TOKEN"

Reading Results

After a test completes, you'll see:

  • Messages delivered — total events successfully delivered
  • p50 / p95 / p99 latency — end-to-end delivery time in milliseconds
  • Connection success rate — percentage of connections established
  • Throughput chart — events per second over the test duration
  • Error breakdown — any connection drops, timeouts, or publish failures

Limits

  • Tests run against your actual app infrastructure, so they count toward your plan's usage
  • Maximum one load test at a time per app
  • Free plans are limited to 100 concurrent connections and 30-second duration