12.35
see origin tiny server in section 11.6 on book
the key is close(connfd)
in both parent and child process to ensure close fd
and reuse it or it’ll failed: Accept error: too many open files
!INCLUDE "./code/12.35.c.diff"
run server
(cd chapter12/code; make && ./12.35)
open another terminal and benchmark it
wrk -d4 http://localhost:5000
output
Running 4s test @ http://localhost:5000
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 62.20ms 87.89ms 348.01ms 82.24%
Req/Sec 397.69 184.95 767.00 58.33%
2585 requests in 4.00s, 578.09KB read
Requests/sec: 645.64
Transfer/sec: 144.39KB
当前内容版权归 DreamAndDead 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 DreamAndDead .