-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Initial work on Keep-Alive #1457
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
Conversation
|
Sorry for the delay; this is pretty awesome. It looks like it's in pretty good shape overall. The biggest issue I see on a first pass is the cache key: we need to exclude As for testing, we at least need to verify that connections are reused for non-identical urls, and that they are not when host, port, or scheme doesn't match (use |
|
Thanks, Ben--very helpful. Apologies for the delay getting back to you on these. We're pushing out a significant update this week. Once we've taken care of that, I'll incorporate your comments. Including the parsed value in the key was a silly mistake. As an anecdote, our primitive tests (using ab with 100 concurrent connections) indicate a 100% improvement in response times over the Curl implementation when using a reusable Simple client connection to interact with an Elasticsearch back end. Hopefully others will find this useful in the future as well. |
|
I found a problem,After many times requests,I got a exception: and when there are different parameters on the url,connection can not be reused. @drewmiller |
|
Any idea when this might be merged/released? |
|
is curl out of the equation for your application? i sort of abandoned this effort when i realized the curl implementation reused connections. Otherwise, it's not too far off. Sent from my iPhone
|
|
How do you get the curl version to reuse connections? Even when I pass "Connection: keep-alive" as a header on the fetch the remote side is receiving "Connection: close" from somewhere... |
|
The application should never touch the |
|
Even when I don't send any headers at all, I'm still seeing "Connection: close" at the remote side:
Any ideas? |
|
The server is not obligated to let you reuse your connection; it can always choose to send |
|
Thanks. Solved it, the connection was routed through a little grunt proxy for dev purposes before it reached the tornado backend. It was that proxy that was adding the "Connection: close" and causing the issue. |
|
Closing this in favor of the updated version in #1622. |
An initial attempt at adding Connection: Keep-Alive pooling to SimpleAsyncHTTPClient per #324.
In order to prevent duplication of the url-parsing step, I converted the current process to a class method that is called and compared against idle connections if the reuse_connections attribute is set. If a new connection is required, the "_ConnectionBase" namedtuple is passed as a parameter to the private _HTTPConnection class so that re-parsing is not necessary.
Please let me know what we can do to improve the testing here.