metosin / pohjavirta

Fast & Non-blocking Clojure wrapper for Undertow
169 stars 8 forks source link

Streams2 #14

Closed ikitommi closed 4 years ago

ikitommi commented 4 years ago

Fix file serving to close the file channels. Use blocking IO as it seems to be faster than NIO here. WHY?

with blocking IO

➜  pohjavirta git:(Streams2) ✗ wrk -t2 -c16 -d10s http://127.0.0.1:8080
Running 10s test @ http://127.0.0.1:8080
  2 threads and 16 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    11.54ms   24.19ms 132.47ms   87.01%
    Req/Sec     4.00k   609.08     5.47k    67.33%
  80445 requests in 10.10s, 14.67GB read
Requests/sec:   7963.88
Transfer/sec:      1.45GB

with NIO

➜  pohjavirta git:(Streams2) ✗ wrk -t2 -c16 -d10s http://127.0.0.1:8080
Running 10s test @ http://127.0.0.1:8080
  2 threads and 16 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    23.04ms   32.01ms 104.22ms   79.49%
    Req/Sec     3.23k     1.00k    5.53k    66.50%
  64410 requests in 10.04s, 11.75GB read
Requests/sec:   6415.37
Transfer/sec:      1.17GB

with Jetty

➜  pohjavirta git:(Streams2) ✗ wrk -t2 -c16 -d10s http://127.0.0.1:8088
Running 10s test @ http://127.0.0.1:8088
  2 threads and 16 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     5.14ms   14.98ms 144.37ms   94.50%
    Req/Sec     3.75k   424.51     6.01k    84.50%
  75127 requests in 10.05s, 13.69GB read
Requests/sec:   7473.10
Transfer/sec:      1.36GB