inspired by handling 1M websockets connections in Go
goroutines per connection
epoll
epoll
multiple epoll
to manage connections in clientmultiple epoll
to manage connections in serverprefork
style of apache to implement serverReactor
pattern to implement multiple event loopsgoroutines per connection
server for test throughtputs and latencymultiple epoll
servergoroutines per connection
servermultiple epoll
servergoroutines per connection
serverE5-2630 V4
cpus, total 20 cores, 40 logicial cores.tune the linux:
sysctl -w fs.file-max=2000500
sysctl -w fs.nr_open=2000500
sysctl -w net.nf_conntrack_max=2000500
ulimit -n 2000500
sysctl -w net.ipv4.tcp_tw_recycle=1
sysctl -w net.ipv4.tcp_tw_reuse=1
client sends the next request only when it has received the response. it has not used the pipeline
style to test.
throughputs (tps) | latency | |
---|---|---|
goroutine-per-conn | 202830 | 4.9s |
single epoll(both server and client) | 42495 | 23s |
single epoll server | 42402 | 0.8s |
multiple epoll server | 197814 | 0.9s |
prefork | 444415 | 1.5s |
workerpool | 190022 | 0.3s |
中文介绍: