Skip to content
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

HTTP pipelining support improvements #6

Closed
telendt opened this issue Dec 1, 2013 · 6 comments
Closed

HTTP pipelining support improvements #6

telendt opened this issue Dec 1, 2013 · 6 comments
Labels

Comments

@telendt
Copy link

telendt commented Dec 1, 2013

Request handling in ServerHttpProtocol implementation executes handle_request coroutines sequentially when HTTP pipelining is used.

Please take a look at the following gist for more details:
https://gist.github.com/telendt/7732021

There are 2 HTTP requests for 2 different resources, each one is available after 1s (I use the asyncio.sleep here, but it can be really some IO happening there). These coroutines might run concurrently (the second one starts when the previous one "waits"), but they run sequentially instead (the second one starts when the previous one terminates).

Of course concurrent execution of handle_requests coroutines would still need to return responses to those requests in the same order that the requests were received. In that case HttpMessage shouldn't write to the transport directly (except of the one from the first pending coroutine) but would need to write to some buffer instead.

@fafhrd91
Copy link
Member

wont fix for now

@ludovic-gasc
Copy link
Contributor

Hi @fafhrd91,

I'm looking for why aiohttp.web+API-Hour is slow compare to others Web frameworks for the plaintext test in FrameworkBenchmarks: https://www.techempower.com/benchmarks/#section=data-r10&hw=peak&test=plaintext&l=1kw

In fact, in this test, they use HTTP pipelining as described in this issue.

Personally, I don't use this feature on production.
For only one benchmark test, it isn't critical to improve that, it's only for your information.
Moreover, I already have an alternative solution to improve that for round 11.

Regards.

@fafhrd91
Copy link
Member

to implement pipelining we would need to introduce write buffer, and that would reduce normal performance. i'm not very interested in plain text performance improvements, my last optimization that gives 50-70% increase of raw performance only gives about 2-3% performance increase in real production systems.

@ludovic-gasc
Copy link
Contributor

my last optimization that gives 50-70% increase of raw performance only gives about 2-3% performance increase in real production systems.

@fafhrd91: Interesting, I've better numbers based on benchmark suite. I'll check statistics on our HAproxy frontends to confirm or invalidate your observations when we'll upgrade our daemons. Nevertheless, maybe you have more CPU-bound tasks than me in your endpoints. Or maybe you have a bigger bottleneck than aiohttp itself.

@telendt
Copy link
Author

telendt commented Apr 28, 2015

to implement pipelining we would need to introduce write buffer, and that would reduce normal performance

Not if the write buffer is only used when needed (if there are any previous pending requests of the same connection). Pipelining could also be enabled/disabled with some protocol level settings. Finally, there could be some configurable "strategies" (when to allow and forbid pipelining).

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants