agrafix / Spock

Another Haskell web framework for rapid development
https://www.spock.li
678 stars 56 forks source link

Performance regression #136

Open flip111 opened 6 years ago

flip111 commented 6 years ago

Based on this code i did a benchmark for spock. There seems to be a significant performance regression compared to scotty at least on the hardware i'm using.

Spock

Benchmarking http://localhost:8080/echo/hello-world (no regex, no captures)
Running 30s test @ http://localhost:8080/echo/hello-world
  8 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    96.49ms   95.52ms   2.00s    96.77%
    Req/Sec   554.94    249.49     2.10k    75.13%
  127390 requests in 30.05s, 43.49MB read
  Socket errors: connect 0, read 0, write 0, timeout 137
Requests/sec:   4239.77
Transfer/sec:      1.45MB
Benchmarking http://localhost:8080/echo/plain/hello (simple captures, no regex)
Running 30s test @ http://localhost:8080/echo/plain/hello
  8 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   102.86ms   89.80ms   1.96s    89.36%
    Req/Sec   566.37    286.40     2.68k    71.92%
  118553 requests in 30.05s, 39.80MB read
  Socket errors: connect 0, read 0, write 0, timeout 166
Requests/sec:   3945.24
Transfer/sec:      1.32MB
Benchmarking http://localhost:8080/echo/regex/42 (regex captures)
Running 30s test @ http://localhost:8080/echo/regex/42
  8 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   112.70ms  115.95ms   1.99s    88.71%
    Req/Sec   583.21    254.60     2.51k    75.58%
  118610 requests in 30.10s, 39.48MB read
  Socket errors: connect 0, read 0, write 0, timeout 143
Requests/sec:   3940.97
Transfer/sec:      1.31MB

Scotty

Benchmarking http://localhost:8080/echo/hello-world (no regex, no captures)
Running 30s test @ http://localhost:8080/echo/hello-world
  8 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    27.56ms   40.97ms   1.10s    99.01%
    Req/Sec     2.01k   727.64    10.17k    85.17%
  479536 requests in 30.05s, 77.74MB read
Requests/sec:  15955.81
Transfer/sec:      2.59MB
Benchmarking http://localhost:8080/echo/plain/hello (simple captures, no regex)
Running 30s test @ http://localhost:8080/echo/plain/hello
  8 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    35.25ms   80.40ms   1.61s    98.53%
    Req/Sec     1.85k   610.63     8.95k    85.31%
  429041 requests in 30.06s, 67.10MB read
Requests/sec:  14273.08
Transfer/sec:      2.23MB
Benchmarking http://localhost:8080/echo/regex/42 (regex captures)
Running 30s test @ http://localhost:8080/echo/regex/42
  8 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    42.43ms   96.23ms   1.96s    98.46%
    Req/Sec     1.53k   506.79     6.68k    90.35%
  357367 requests in 30.04s, 54.87MB read
Requests/sec:  11897.58
Transfer/sec:      1.83MB

hardware

Processor | 4x Intel(R) Core(TM) i3-4005U CPU @ 1.70GHz
Memory | 8092MB (5601MB used)
Operating System | Ubuntu 16.04.3 LTS
Kernel | Linux 4.4.0-103-generic (x86_64)
agrafix commented 6 years ago

Interesting ... Have you tried benchmarking it against the Spock-core api?

agrafix commented 6 years ago

Also curious about the Socket errors: connect 0, read 0, write 0, timeout 137 happening with Spock :/

flip111 commented 6 years ago

Interesting ... Have you tried benchmarking it against the Spock-core api?

No i haven't, what would that entail?

Also curious about the Socket errors: connect 0, read 0, write 0, timeout 137 happening with Spock :/

Hadn't noticed that before ... seems like something that needs to be investigated as well ^^