How to load test Server Sent Events?
benchmarking, load-testing, server-sent-events
Solution
Since `Server-Sent Events` it is just HTTP you can use `siege` utility. Here is the example:
siege -b -t 1m -c45 http://127.0.0.1:9292/streaming
Where:
- `-b` benchmark mode i.e. don't wait between connections
- `-t 1m` benchmark for 1 minute
- `-c45` number of concurrent connections
- `http://127.0.0.1:9292` my dev server host and custom port
- `/streaming` HTTP-endpoint which respond with `Content-Type: text/event-stream`
Output:
Lifting the server siege... done.
Transactions: 79 hits
Availability: 100.00 %
Elapsed time: 59.87 secs
Data transferred: 0.01 MB
Response time: 23.43 secs
Transaction rate: 1.32 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 30.91
Successful transactions: 79
Failed transactions: 0
Longest transaction: 30.12
Shortest transaction: 10.04
Problem
I have a small app that sends Server Sent Events. I would like to load test my app so I can benchmark the latency from the time a message is pushed to the time the message is received so I can know when/where the performance breaks down. What tools are available to be able to do this?