12.36
check section 11.6 and 12.2.1, combine code pieces together
code directory: chapter12/code/12.36
origin tiny server: tiny.h tiny.c
select echoserver: echoserver.h echoserver.c
key points:
- move main loop to main.c file
check_clients
in echoserver calldoit
(from tiny server) and close fd
benchmark it
Running 4s test @ http://localhost:5000
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 62.72ms 91.68ms 368.55ms 82.94%
Req/Sec 615.27 398.96 1.46k 65.91%
3649 requests in 4.00s, 816.04KB read
Requests/sec: 911.45
Transfer/sec: 203.83KB
当前内容版权归 DreamAndDead 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 DreamAndDead .