tornado icon indicating copy to clipboard operation
tornado copied to clipboard

HTTP/2 support

Open dvirsky opened this issue 10 years ago • 43 comments

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

dvirsky avatar May 05 '15 08:05 dvirsky

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

v3ss0n avatar May 06 '15 16:05 v3ss0n

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.

bdarnell avatar May 07 '15 03:05 bdarnell

thats awesome!

v3ss0n avatar May 07 '15 07:05 v3ss0n

@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.

dvirsky avatar May 07 '15 08:05 dvirsky

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

bdarnell avatar May 10 '15 02:05 bdarnell

Thanks, good job!!

Garfielt avatar May 12 '15 01:05 Garfielt

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.

jsarenik avatar Jul 14 '15 15:07 jsarenik

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

On Tue, Jul 14, 2015 at 9:55 PM, Ján Sáreník [email protected] wrote:

Any news here?

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

v3ss0n avatar Jul 14 '15 15:07 v3ss0n

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.

bdarnell avatar Jul 14 '15 17:07 bdarnell

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 [email protected] 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 .

v3ss0n avatar Jul 14 '15 19:07 v3ss0n

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

arturican avatar Jul 14 '15 21:07 arturican

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?

rickhanlonii avatar Oct 06 '15 15:10 rickhanlonii

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.

bdarnell avatar Oct 07 '15 01:10 bdarnell

@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?

hunt3r avatar Oct 28 '15 14:10 hunt3r

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.

bdarnell avatar Oct 29 '15 01:10 bdarnell

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

HelloGrayson avatar Dec 14 '15 22:12 HelloGrayson

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

bdarnell avatar Jan 03 '16 18:01 bdarnell

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:

  • no follow redirections
  • one connection each client, and connect once client object is built
  • HTTP20Response with push_responses, new_request(for redirection)
  • once connection was broken, all sent request are broken as exception HTTP2ConnectionClosed()

features:

  • connect_timeout & request_timeout
  • push streams
  • h2 & h2c supporting
  • do auto-reconnect to server
  • stream multiplexing
  • stream concurrency negotiating

boyxuper avatar Feb 04 '16 06:02 boyxuper

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

rafaelcapucho avatar May 02 '16 14:05 rafaelcapucho

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?

bdarnell avatar May 13 '16 00:05 bdarnell

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.

v3ss0n avatar May 14 '16 12:05 v3ss0n

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.

yeraydiazdiaz avatar Apr 29 '17 11:04 yeraydiazdiaz

@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.

ghost avatar Dec 31 '17 17:12 ghost

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

bdarnell avatar Dec 31 '17 23:12 bdarnell

Great, welcome http2

yanmingwang avatar Jan 31 '18 02:01 yanmingwang

will tornado_http2 merge into tornado?

xmm1989218 avatar Oct 09 '18 16:10 xmm1989218

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.

bdarnell avatar Oct 10 '18 01:10 bdarnell

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

v3ss0n avatar Nov 16 '18 15:11 v3ss0n

@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 =)

wpjunior avatar Nov 17 '18 16:11 wpjunior

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.

lisongmin avatar Feb 02 '19 02:02 lisongmin