12.37
see origin tiny server in section 11.6 on book
the key is how to pass connfd into thread
!INCLUDE "./code/12.37.c.diff"
run server
(cd chapter12/code; make && ./12.37)
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 60.24ms 87.59ms 354.24ms 82.32%
Req/Sec 481.88 276.48 1.09k 66.67%
3151 requests in 4.10s, 704.67KB read
Requests/sec: 768.63
Transfer/sec: 171.89KB
当前内容版权归 DreamAndDead 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 DreamAndDead .