Hi Folks,
I’m seeing unexpectedly poor performance with Cowboy 2.13.0 on Erlang 28.0.2.
Load testing shows only 8.7K RPS with 1-second average response times for simple GET requests serving static content (a small 33-byte file). This seems far below what Erlang should handle.
Setup
- Erlang: 28.0.2
- Cowboy: 2.13.0
- Platform: macOS M1
Cowboy Configuration
active_n: 10
request_timeout: 5000
idle_timeout: 5000
inactivity_timeout: 10000
max_keepalive: 100
http10_keepalive: true
dynamic_buffer: true
Load Test Command hey
$ ulimit -n 65536
$ sudo sysctl net.inet.ip.portrange.first=1024
$ sudo sysctl net.inet.ip.portrange.last=65535
$ brew install hey
$ hey -n 10000 -c 10000 -z 10s http://localhost:8080/
Summary:
Total: 10.8376 secs
Slowest: 2.9020 secs
Fastest: 0.0497 secs
Average: 1.1103 secs
Requests/sec: 8710.7259
Total data: 3115299 bytes
Size/request: 33 bytes
Response time histogram:
0.050 [1] |
0.335 [1018] |■
0.620 [1787] |■
0.905 [3316] |■■
1.191 [76507] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
1.476 [5195] |■■■
1.761 [1803] |■
2.046 [598] |
2.332 [1133] |■
2.617 [1465] |■
2.902 [1580] |■
Latency distribution:
10% in 0.9844 secs
25% in 1.0072 secs
50% in 1.0420 secs
75% in 1.0818 secs
90% in 1.3080 secs
95% in 1.8275 secs
99% in 2.8010 secs
Details (average, fastest, slowest):
DNS+dialup: 0.0162 secs, 0.0497 secs, 2.9020 secs
DNS-lookup: 0.0021 secs, 0.0000 secs, 0.0607 secs
req write: 0.0000 secs, 0.0000 secs, 0.0254 secs
resp wait: 1.0227 secs, 0.0288 secs, 1.4419 secs
resp read: 0.0002 secs, 0.0000 secs, 0.1046 secs
Status code distribution:
[200] 94403 responses
Question
Is 8.7K RPS with 1-second latencies normal for Cowboy serving static content, or should I expect much higher throughput? What’s typically the bottleneck at these low numbers?
Note: I’m specifically interested in raw Cowboy/Erlang performance. I want to understand the baseline performance characteristics (not putting Cowboy behind a proxy like Nginx or other workarounds). HTTP/2 testing showed no performance improvement over HTTP/1.1, so I’m focusing on HTTP/1.1 for this issue.
Link: Survey of Cowboy Webserver Performance
Thanks
