SuaveIO / suave

Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.
https://suave.io
Other
1.32k stars 197 forks source link

suave.libuv (0.33 pre-release) ignore keep-alive ? #313

Closed vietnt closed 9 years ago

vietnt commented 9 years ago

WeighHttp + Suave.Libuv 0.33 + libuv 1.7.5 (64bit) OS: Windows 10 Pro

previous versions (Suave 0.32) + WeighHttp run OK

haf commented 9 years ago

Could you link us to how to reproduce this? WeighHttp doesn't turn up when googling...

vietnt commented 9 years ago

link to WeigHttp

code to reprocedure:

[<EntryPoint>]
let main argv = 
    let cfg = { defaultConfig with tcpServerFactory = LibUvServerFactory(); maxOps = 1000 }
    startWebServer cfg (OK "hello world")
    System.Console.ReadLine() |> ignore
    0

command to WeigHttp:

-n 10000 -c 10 -k localhost:8083  //keepalive
-n 10000 -c 10 localhost:8083 //no-keepalive

same requests per seconds, Antimalware Service Executable 3-40% cpu all the time are the hints

haf commented 9 years ago

Thank you. I think it's great that we have people like yourself to test prereleases!

/ping @ademar

ademar commented 9 years ago

Keep-alive shouldn't depend on the tcp layer.

On Saturday, 24 October 2015, Henrik Feldt notifications@github.com wrote:

Thank you. I think it's great that we have people like yourself to test prereleases!

/ping @ademar https://github.com/ademar

— Reply to this email directly or view it on GitHub https://github.com/SuaveIO/suave/issues/313#issuecomment-150823775.

Ademar Gonzalez +1-647-891-3606 http://ademar.name https://github.com/ademar

vietnt commented 9 years ago

more tests, hope it help!

default tcp factory:

libuv-factory:

vietnt commented 9 years ago

Everything seems ok with single-connection (e.g browser), and weigHttp report 99%+ failed requests -> it may force-close the connection in every failed requests (99% in this case) -> no diff between keep-alive vs non keep-alive.

I will retry the test with another tool and update the result

vietnt commented 9 years ago

ab (apache bench) (os: Windows)

same result for: suave 0.32 | (suave 0.33 - libuv | default tcp)

haf commented 9 years ago

With DefaultTcpServerFactory

➜  suave git:(master) ✗ ab -k -c 15 -t 20 http://127.0.0.1:8082/hello
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests

Server Software:        Suave/0.33.0.0
Server Hostname:        127.0.0.1
Server Port:            8082

Document Path:          /hello
Document Length:        11 bytes

Concurrency Level:      15
Time taken for tests:   15.320 seconds
Complete requests:      50000
Failed requests:        0
Keep-Alive requests:    50000
Total transferred:      8900000 bytes
HTML transferred:       550000 bytes
Requests per second:    3263.73 [#/sec] (mean)
Time per request:       4.596 [ms] (mean)
Time per request:       0.306 [ms] (mean, across all concurrent requests)
Transfer rate:          567.33 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     3    5   2.1      4     122
Waiting:        0    1   1.9      1     116
Total:          3    5   2.1      4     122

Percentage of the requests served within a certain time (ms)
  50%      4
  66%      4
  75%      5
  80%      5
  90%      6
  95%      6
  98%      6
  99%      6
 100%    122 (longest request)

OS X, Mono, Warn-level logging in Suave. Including keep-alive. Mono 4.2 x86_64.

With LibUvServerFactory:

➜  suave git:(master) ✗ ab -k -c 15 -t 20 http://127.0.0.1:8082/hello
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests

Server Software:        Suave/0.33.0.0
Server Hostname:        127.0.0.1
Server Port:            8082

Document Path:          /hello
Document Length:        11 bytes

Concurrency Level:      15
Time taken for tests:   8.895 seconds
Complete requests:      50000
Failed requests:        0
Keep-Alive requests:    50000
Total transferred:      8900000 bytes
HTML transferred:       550000 bytes
Requests per second:    5620.87 [#/sec] (mean)
Time per request:       2.669 [ms] (mean)
Time per request:       0.178 [ms] (mean, across all concurrent requests)
Transfer rate:          977.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     1    3   2.0      3     115
Waiting:        0    1   1.9      1     107
Total:          1    3   2.0      3     115

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      3
  75%      3
  80%      3
  90%      3
  95%      3
  98%      4
  99%      4
 100%    115 (longest request)