tornadoweb / tornado

Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.
http://www.tornadoweb.org/
Apache License 2.0
21.69k stars 5.5k forks source link

HTTP/2 support #1438

Open dvirsky opened 9 years ago

dvirsky commented 9 years ago

It would be nice to see tornado implement http/2, not that AFAIK it's a standard.

v3ss0n commented 9 years ago

Need to wait a bit till that standard become stable. Right?

bdarnell commented 9 years ago

The standard isn't finalized, but it's close enough to work with. I have some work in progress at https://github.com/bdarnell/tornado_http2. It's in decent shape but it doesn't support flow control yet so it only works for small requests and responses.

v3ss0n commented 9 years ago

thats awesome!

dvirsky commented 9 years ago

@bdarnell that's great. do you need help with specific things? I don't know the standard too well but I've skimmed over it and I know the general idea.

bdarnell commented 9 years ago

Not really. The last thing left is flow control but it doesn't really lend itself to being worked on in parallel.

Garfielt commented 9 years ago

Thanks, good job!!

jsarenik commented 9 years ago

Any news here? I have read the other posts so as far as I understand it will be not done until the protocol is finalized.

v3ss0n commented 9 years ago

Why so hurry, standard is so far from getting standardized .

On Tue, Jul 14, 2015 at 9:55 PM, Ján Sáreník notifications@github.com wrote:

Any news here?

— Reply to this email directly or view it on GitHub https://github.com/tornadoweb/tornado/issues/1438#issuecomment-121281269 .

bdarnell commented 9 years ago

The standard is finalized (https://tools.ietf.org/html/rfc7540), but I don't have anything else to report. I haven't had time to work on this recently.

v3ss0n commented 9 years ago

Oops , i must be living under the rocks. when was that? That didn't even make much news.

On Wed, Jul 15, 2015 at 12:03 AM, Ben Darnell notifications@github.com wrote:

The standard is finalized (https://tools.ietf.org/html/rfc7540), but I don't have anything else to report. I haven't had time to work on this recently.

— Reply to this email directly or view it on GitHub https://github.com/tornadoweb/tornado/issues/1438#issuecomment-121317269 .

arturican commented 9 years ago

Wow, standart is finalized so it would be nice uf this feature has been implemented

rickhanlonii commented 8 years ago

Just noting that Chrome abandoned SPDY for HTTP2 and every iOS 9 application is HTTP/2 by default.

@bdarnell I noticed that https://github.com/tornadoweb/tornado/pull/525#issuecomment-118635107 references https://github.com/bdarnell/tornado_http2. Is that a full implementation and can you imagine a way to reconcile the two?

bdarnell commented 8 years ago

As I said before, the major piece missing from tornado_http2 is flow control. #525 implemented SPDY, not HTTP/2, which didn't have the same flow control protocol and so I don't think there's anything to reconcile there. I don't know when I'll be able to finish up flow control so if anyone would like to work on this feel free to claim it.

hunt3r commented 8 years ago

@bdarnell do you have a checklist of what parts of the spec have been completed vs. incomplete? I may be able to assist, but it would be useful to know what state you're in?

bdarnell commented 8 years ago

No, I don't have a checklist. Off the top of my head, there's flow control and prioritization, and then there's a lot of places in the spec that dictate a certain error-handling behavior that we need to go through and check.

HelloGrayson commented 8 years ago

Looks like flow control made it into the spec? https://tools.ietf.org/html/rfc7540#section-5.2

bdarnell commented 8 years ago

Flow control is now implemented in https://github.com/bdarnell/tornado_http2, so it's ready for more usage and testing.

boyxuper commented 8 years ago

I think HTTP/2 is more meaningful with connection reuse & stream multiplexing, especially with lots of API query in same origin. And I've wrote a client, requires h2==2.1.0 & tornado >= 4.0, here's the code https://github.com/mSOHU/http2

usage: client = SimpleAsyncHTTP20Client(host=''[, port=], secure=<True | False>, max_streams=30, connect_timeout=1) then you can use client like old SimpleAsyncHTTPClient

differents:

features:

rafaelcapucho commented 8 years ago

Hello, There are any plans to merge the HTTP/2 support to tornado main branch? Thank you

bdarnell commented 8 years ago

I plan to merge the HTTP/2 support into Tornado eventually, but not until it's been proven successful. I haven't heard any reports from people using the tornado_http2 package (positive or negative). Are you using it? Is it working for you? What difference does it make for you whether it's in the master branch or a separate package?

v3ss0n commented 8 years ago

I haven't try HTTP/2 yet. Busy with our own startup product on pypy + tornado + rethinkdb, actually HTTP2 is really necessary for us. So we will be testing soon.

yeraydiazdiaz commented 7 years ago

Hi all, I've been working on a different approach on an HTTP/2 server using the hyper-h2 library, here's a quick demo.

It's not feature complete but I've managed to integrate it with the web framework allowing RequestHandler classes to respond seemlessly.

Any feedback or comments would be most welcome, and of course, thanks for the excellent work on Tornado.

ghost commented 6 years ago

@bdarnell I have recently attempted to use the tornado_http2 package but it appears the _ServerRequestAdapter is not apart of Tornado anymore so I was unable to spin it up.

bdarnell commented 6 years ago

I've updated tornado_http2 to work with (and probably require) tornado 4.5

yanmingwang commented 6 years ago

Great, welcome http2

xmm1989218 commented 5 years ago

will tornado_http2 merge into tornado?

bdarnell commented 5 years ago

will tornado_http2 merge into tornado?

Maybe someday, but I think it only makes sense to merge http/2 into the main package after it's been proven to be usable and reliable as a separate package. Right now I've only heard from one person other than myself who's even tried tornado_http2.

v3ss0n commented 5 years ago

Many Nodejs frameworks are resupporting HTTP2. Python community (including myself) is really slow on adopting HTTP2.

wpjunior commented 5 years ago

@bdarnell Hi, I achieved use of httpclient using http2 with curl, libcurl >= 7.43.0 supports multiplexed requests well, just setting up the number of max_clients =)

lisongmin commented 5 years ago

I suggest merge http2 into tornado as an experiemntal feature.

so we can running tornado as http/1.1 on product environment, and test http/2 on develop environment with a switch easily.

In this way, we can accelerate http/2 stable, also keep http/2 with latest tornado base. and get more feedback from community too.

tstordyallison commented 5 years ago

@lisongmin do you suggest we go down the tornado_http2 route or take a look at @yeraydiazdiaz's work on integrating the hyper-h2 library?

hyper-h2 feels like it's approaching something that could be called stable from what I could tell, which makes it a tempting option for something usable in tornado in the near-term.

I'm interested in pushing the hyper-h2 path forward/helping out if others think it's worth it.

tstordyallison commented 5 years ago

In fact, they even have a tornado example (using TCPServer): https://python-hyper.org/h2/en/stable/tornado-example.html

h5rdly commented 5 years ago

Quart has http/2 support - https://pgjones.gitlab.io/quart/http2_tutorial.html

Tornado is well up to date with modern standards, http/2 would be quite on point imo

pylorak commented 5 years ago

Beside choosing between tornado_http2 and hyper-h2 (btw I'd vote for the latter, hyper-h2 is used by multiple projects and is well-tested, so why implement something so non-trivial from scratch in tornado), there is a 3rd option which IMHO is also very interesting, might even be the best:

-> Add ASGI support to tornado.

This would fill two needs with one deed. First, it'd allow users of tornado to freely match their webserver with tornado. Of course the webserver also needs to support ASGI, but there are already multiple ones available (daphne, hypercorn, uvicorn).

Second advantage of supporting ASGI, and the one relevant for this topic, is that HTTP/2-support then becomes a question not for tornado, but for the ASGI server. Two of the three aforementioned servers support HTTP/2 already, so using them with tornado would automatically add HTTP/2 support to tornado.

h5rdly commented 5 years ago

But then you won't be able to use http/2 using tornado alone, correct?

pylorak commented 5 years ago

But then you won't be able to use http/2 using tornado alone, correct?

Only in a sense. Tornado alone would still be your only application framework component. You'd only use it with an external webserver instead of the built-in one.

Aeron commented 5 years ago

How about to move to MagicStack’s httptools?

Cons:

Pros:

v3ss0n commented 5 years ago

Not necessary, It would slow on pypy .

On Tue, Jun 4, 2019 at 6:24 PM Eugene Glybin notifications@github.com wrote:

How about to move to MagicStack’s httptools https://github.com/MagicStack/httptools?

Cons:

  • It will require to rewrite current HTTP parsing, but for the best in my opinion;
  • Another external dependency.

Pros:

  • Fast async HTTP parsing;
  • HTTP/2 support out-of-the-box.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tornadoweb/tornado/issues/1438?email_source=notifications&email_token=AADGOFR773EP3CT273TI7SDPYZJWLA5CNFSM4BCAIQ22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW4KE4I#issuecomment-498639473, or mute the thread https://github.com/notifications/unsubscribe-auth/AADGOFWVGPURRCVBCWB7RZTPYZJWLANCNFSM4BCAIQ2Q .

arduinka55055 commented 3 years ago

so, do you have some progress on it? 2021 year, and cloudflare for example even has http3 with QUIC

still waiting. tornado is awesome anyway

bdarnell commented 3 years ago

I have no new updates since https://github.com/tornadoweb/tornado/issues/1438#issuecomment-428408639

The next step here is for folks in the community to try the implementations that already exist and report back - do they work well and meet your needs? That feedback must come before anything can be considered for merging into Tornado proper.

v3ss0n commented 2 years ago

i agree with @bdarnell . I haven't had any use of HTTP2 yet. Someone have any idea to start a HTTP2 demo and test?