-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
do we need http pipelining? #2109
Comments
Not sure. |
removing pipelining would simplify request handling flow. (some speedup is expected too) |
on other hand pipelining help in synthetic benchmarks |
I'm not sure about as well. If HTTP/1 pipelining support cause maintenance issues, slows down general HTTP usage and gives only profit in synthetic benchmark, I think there is nothing much to think about. It's pretty cool, but not very popular feature for HTTP/1, but it's a core one of HTTP/2. May be move it HTTP/2 implementation if any will happens? Btw, do we know any aiohttp usage with pipelining in the wild? |
Pipelining gives nice 25% boost in synthetic tests :) |
how much code does it actually run? add business logic written in python and some logging, and this thing would show same speed as any other python framework. |
I added pipelining because of benchmarks :) |
I think pipelining is only really used in tests. The mistake it tests/benchmarks allowing it/being too simple. For me, remove if it makes code simpler or provides any other speedups. |
I have a proposal for that. Right now Aiohttp implements HTTP pipelining but this feature is not fully enabled - correct me if Im wrong @fafhrd91. The default concurrence per connection [1] does not allow Aiohttp to process more than one request at a time. Having this scenario and taking into account the complexity that this feature adds in terms of code and the low usage in production systems, almost in microservices architectures, I would propose to reduce the current HTTP pipelining to a more naive implementation that does not support concurrence in the same connection. Why ?
How ?
[1] https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_protocol.py#L96 |
Pipelining is disabled because of benchmarks. On primitive benchmarks pipelining costs about 4-7% I am fine with removing pipelining, but pipelined request still should be supported with concurrency 1 |
Oks, once the pipelining has been simplified using a naive implementation we can move forward to the next steps. @fafhrd91 you suggested that we might get rid of the Right now Aiohttp needs at least the following three layers to handle the response: an instance of
This would be the sketch more or less, surely I will face problems that right now I cant see them. Anyway, thoughts @fafhrd91 and @asvetlov ? |
I do not remember all details, I wrote this code year ago. If you can simplify all three layers to only SessionResponse, that would be great.
Some notes:
* http_xxx.py modules are reused by client and server
* server file response
* stream write is just wrapper for transport, but payload write is actual data encoder
…Sent from my iPhone
On Dec 28, 2017, at 1:17 AM, Pau Freixes ***@***.***> wrote:
Oks, once the pipelining has been simplified using a naive implementation we can move forward to the next steps. @fafhrd91 you suggested that we might get rid of the StreamWriter once we have removed the complexity under the hood, my suggestion heads to remove the big fish, the PayloadWriter.
Right now Aiohttp needs at least the following three layers to handle the response an instance of StreamWriter, an instance of PayloadWriter and finally an instance of StreamResponse, also derivates of the last two ones are allowed. The idea is to reduce these three layers to just the StreamResponse one. My gut feeling says that it's doable that would be done making the following changes:
Get rid of the superfluous StreamWriter and turn the TCP tunning operations as simple functions.
Create an AbstractResponse as a replacement of the AbstractPayloadWriter specifying the functions that must be implemented. Basically, write methods.
Move the current logic of the write methods that are in the PayloadWriter to the current write methods of StreamResponse.
The StreamResponse - once is called the prepare method - will use the transport rather than use the PaylodWriter.
Derivates as web file response u others must implement only one derivate of the StreamResponse class.
This would be the sketch more or less, surely I will face problems that right now I cant see them. Anyway, thoughts @fafhrd91 and @asvetlov ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
+1 |
I don’t think any breakage will require |
I hope so |
Finally, I decided to go a bit slower taking into account that I could end up having something almost impossible - to hard - to review and also to make my process to change all of this with small iterations that will help us definitely. So next MR just get rids the current legacy class |
* Get rid of legacy StreamWriter (#2623) Legacy StreamWriter as a pure proxy of the transport and the protocol is no longer needed. All of the functionalities that were behind this class has been moved to the PayloadWriter. Some changes that have to be considered that impacted during this change * TCP Operations have been isolated in a module rather than move them into the PayloadWriter * WebSocketWriter had a dependency with the StreamWriter, to get rid of that dependency the constructor has been modified to take the protocol and the transport. A next step changing the name PayLoadWriter for the StreamWriter to have consistency with the reader part, might be considered. * Add CHANGES * Fixed invalid import order * Fix test broken * Fix tcp_cork issues * Test PayloadWriter properties * Avoid return useless values for tcp_<operations> * Increase coverage http_writer * Increase coverage web_protocol
For now, Im gonna "give up" at that point. Meaning that I won't go deeper to refactor more code, the reason is basically it is getting harder and harder and I need some time for rest regarding this subject. Beside of that, don't you believe that this issue can be closed? Taking into account that the pipelining support has been maintained but making it simpler having the same expectations. |
Agree |
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. |
@asvetlov @kxepal thoughts?
The text was updated successfully, but these errors were encountered: