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 call doit(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
comments powered by Disqus