-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep alive doesn't work as expected + performance problems #580
Comments
You're right that the keep-alive parameter appears to do nothing. We certainly tell Hyper to set the value to the configured value: Unfortunately, either hyper ignores this or is buggy. Other hyper-related "waiting" issues have been reported, so I'm inclined to believe the issue lies with hyper. |
I took a closer look at this today. On the latest master (though I don't think this has changed), setting a keep_alive of Clients don't always take the hint, so servers tend to close the connection themselves after all of the data has been sent/received. I've patched I don't think this is related to what you're seeing. Instead, this appears to be an |
I think the bug is still present in all 0.4.x releases, it is reproducible with e.g. strohel@mat480s ~/projekty/Rocket/examples/hello_world $ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.20s
Running `/home/strohel/projekty/Rocket/target/debug/hello_world`
🔧 Configured for development.
=> address: localhost
=> port: 8000
=> log: normal
=> workers: 16
=> secret key: generated
=> limits: forms = 32KiB
=> keep-alive: 5s
=> tls: disabled
🛰 Mounting /:
=> GET / (hello)
🚀 Rocket has launched from http://localhost:8000 strohel@mat480s ~/projekty/Rocket/examples/hello_world $ curl -v http://localhost:8000/ http://localhost:8000/
* Trying ::1:8000...
* Connected to localhost (::1) port 8000 (#0)
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.72.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< Server: Rocket
< Content-Length: 13
< Date: Thu, 24 Sep 2020 11:16:44 GMT
<
* Connection #0 to host localhost left intact
Hello, world!
* Found bundle for host localhost: 0x560ac3bc55c0 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host localhost
* Connected to localhost (::1) port 8000 (#0)
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.72.0
> Accept: */*
>
* Connection died, retrying a fresh connect(retry count: 1)
* Closing connection 0
* Issue another request to this URL: 'http://localhost:8000/'
* Hostname localhost was found in DNS cache
* Trying ::1:8000...
* Connected to localhost (::1) port 8000 (#1)
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.72.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< Server: Rocket
< Content-Length: 13
< Date: Thu, 24 Sep 2020 11:16:44 GMT
<
* Connection #1 to host localhost left intact
Hello, world! ^^^ Notice the I've traced the problem down to a bug in hyper 0.10.x BufReader and submitted a fix in hyperium/hyper#2288 - but I don't know whether the old 0.10.x branch is still maintained. |
..which has been closed as the maintainers (understandably) don't want to release a new 0.10.x version. Then I'd suggest to change the default |
During Apache Benchmark tests with the configuration below:
Keep-Alive doesn't work and after some time
ab
receive:Apache benchmark works fine with below parameters in other frameworks (Akka Http, Finagle):
ab -k -t 90 -c 100 -n 1000000000 http://localhost:8081/data
To add up more information to the loop (Rocket AB benchmark):
and Akka Http benchmark:
The text was updated successfully, but these errors were encountered: