12.37

    see origin tiny server in section 11.6 on book

    the key is how to pass connfd into thread

    1. !INCLUDE "./code/12.37.c.diff"

    run server

    1. (cd chapter12/code; make && ./12.37)

    open another terminal and benchmark it

    1. wrk -d4 http://localhost:5000

    output

    1. Running 4s test @ http://localhost:5000
    2. 2 threads and 10 connections
    3. Thread Stats Avg Stdev Max +/- Stdev
    4. Latency 60.24ms 87.59ms 354.24ms 82.32%
    5. Req/Sec 481.88 276.48 1.09k 66.67%
    6. 3151 requests in 4.10s, 704.67KB read
    7. Requests/sec: 768.63
    8. Transfer/sec: 171.89KB