-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
aiohttp support for http/2 protocol #863
Comments
aiohttp already works fine with nginx-1.10.0 over http2. That should cover much of http2. I guess aiohttp will take some modification to support "Server push", but even nginx doesn't support that yet. |
I'm glad, that nginx supports partial http2 features. They takes their own way. |
I'm not an aiohttp core dev, this post only represent my personal opinion: I already spent a lot of my (personal) time only to understand correctly HTTP/1.1 and have enough understanding in aiohttp to put asyncio daemons on production. Now, I can deliver and debug daemons quickly with this stack, and for now, it's enough efficient for our needs. However, don't misinterpret me: If you want HTTP/2, just code it. As a pull request of aiohttp or a new project, just code it, I'll pretty happy to test. |
from my production experience i found that frame based protocols are very slow if parser is written in python. so to make aiohttp work well with http/2 we really need c-module for that. |
@fafhrd91 That's not really true. Frame based protocols have the potential to be substantially faster than line-based protocols written in Python if care is taken with the way the library is designed. For example, consider aiohttp's current parser/buffer interaction. This implements a coroutine that repeatedly searches a data buffer for a newline character. These loops are written in C, which can be relatively fast, but nonetheless require that every single byte in the buffer be touched. This is not true of HTTP/2, which has length-prefixed frames and length-prefixed header fields. This makes parsing comparatively trivial: splitting data into logical chunks doesn't require searching for delimiters, as everything is length-prefixed. Regardless, in any moderately complex web application written on top of aiohttp the vast majority of the time will be spent in the application code itself. Performance improvements in the parser are useful (giving more CPU time to the application), but the gains obtained from moving to a C-based parser will be relatively minimal. |
we (at KeepSafe) have one service in production that uses frame-based binary protocol. it is written on top of aiohttp. and i think this was of the architectural mistakes that i made when developing it. while with python you can write very nice high level apis, and abstract-away all framing and binary low-level functionality into easy to use, high level api, python is so slow and unpredictable under high load that it kills all good things. now we are migrating from that implementation to plain stateless http. so i am not very excited about http2. |
@fafhrd91, it isn`t shared anywhere? The protocol is the other kind than http2, right? Anyway, it will be nice to see what behind the hood in your solution. Sad to hear about unpredictable behaviour caused by python itself. |
Well, I don't think it's a question of whether HTTP/2 is a good idea or not. It has been accepted as a standard and will gain wide-spread adoption. HTTP/2-only services will come, sooner or later. If we can't talk to HTTP/2 services with aiohttp, we will lose flexibility. (FWIW, my #1 for loving to see the HTTP/2 client side implemented in aiohttp is in order to communicate with Apple's new PUSH service which is a HTTP/2 server). |
Perhaps more importantly, if aiohttp doesn't grow HTTP/2 support it will be at risk of being overtaken by a project that is willing to do HTTP/2. Both Twisted and Tornado are working on their HTTP/2 support, with Twisted likely to ship a HTTP/2 server sometime this year (I know that because I'm building it). If aiohttp is uninterested in HTTP/2 (which it's allowed to be, you can run the project however you like!) I wouldn't be surprised to see someone pick up h11 and hyper-h2 and use those as the basis for an alternative asyncio-based HTTP implementation. Having those two projects around greatly lowers the barrier to entry for someone else wanting to build alternative to aiohttp. |
See also #320 |
if anyone wants to work on http2 please open new issue |
Is there any activity to implement http/2 capability to aiohttp or any reason to not implement it?
The text was updated successfully, but these errors were encountered: