-
-
Notifications
You must be signed in to change notification settings - Fork 763
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 2.0 Support #47
Comments
@tomchristie if you're going to use h2 for http2, it might be worth using https://github.com/njsmith/h11 for http 1.1. As they both have the same interface |
I'd certainly like to have h11 as an option for a pure python interface yes. |
@tomchristie there's been lots of talk about getting httptools and h11 to share an interface. |
That would be pretty ace. Anywhere worth following? |
There was some stuff on IRC a while ago, and https://github.com/njsmith/h11/issues/9 |
mostly worried about:
|
+1 for being PyPy-friendly. I think a lot of people who are interested in uvicorn will want to use PyPy as well for the same reason (performance). |
@thedrow fyi Hyper is implemented using h2 |
We're in a good place to tackle this now, against 0.2. |
@tomchristie How do you think this one is important? If there's no higher priority around I can give it a crack with h2. |
It’d be a great addition yup! |
@gvbgduh - https://pypi.org/project/trustme/ may come in handy here. |
That's awesome, thanks a lot @tomchristie! I'll give it a try. |
Yes, it actually works well!
Update: And |
@tomchristie I've been going round in circles with some issues/questions for a while. I'm currently implementing the simplest flow and to finish this I'd love to hear your advice/opinion about what's the best strategy to close the connection. The matter is that the request-response is tied to the streams against the connection, and on the one hand, it's advised that
as of https://tools.ietf.org/html/rfc7540#section-9.1. On the other hand, I see that in It's probably an additional question how to manage the keep-alive policy as well. I also wonder if it's worth keeping in mind the connection reuse as of https://tools.ietf.org/html/rfc7540#section-9.1.1, but it seems to be rather a complex feature. |
I don’t see any reason to differ from our HTTP/1.1 keep-alive policy. The “keep them hanging around for as long as possible” seems like nonsense to me. |
Yeah, fair enough indeed, not sure how I stuck in other thoughts, but it took to write it down to see it's quite obvious. Thanks! |
Any Progress about this issue? |
I'm going to give it a try on this, on this weekend. |
Kludex, did you have any luck? ^^ |
I was on it and then I forgot I was working on it. 😅 I'll continue on it this weekend (and open a PR, even if uncompleted). EDIT: I'm too busy. I will not be able to provide a PR any time soon. If interested, feel free to give it a try. 😗 |
Hello folks, I've been doing some work in this PR. I've written most of the important points in the first comment so that it's easier to review. I'll ping about it in the Gitter as well 👍 |
@tomchristie Should I assume this issue is not valid anymore, considering what was discussed here? |
Yes - let's close this off.
It also doesn't have trio support, and that's okay too. We ought to do a good good of promoting Hypercorn, which does have both of those features, and make sure that we're focused on improving the ASGI ecosystem as a whole, rather than trying to "win" in any particular category. Being scoped to just asyncio + HTTP/1.1 + websockets is plenty enough for this particular project. |
Yes, now I can see this because many asgi servers just run behind a proxy (like nginx), so those proxy servers can be used to add http/2 support and similar features. |
IMO http2 is much more interesting for browser <-> server communication, which usually is handled by something in front of uvicorn. I'd say for microservice <-> microservice communication true http/2 (multiplexing streams) actually complicates load balancing a lot for not that much benefit. |
In other words, good call if we're dealing with limited resources. |
Fun story: at some company I worked for 3 engineers spent 2 weeks rewriting a WSGI app into an ASGI app that would use Hypercorn just to "get HTTP/2" under the false impression that would help with client performance. Obviously the real issue was high-level architecture, but the part that's funny for this story is that I was able to pull up logs showing that most clients had already been using HTTP/2 because the app was behind NGINX anyway. |
I haven't dug into this in a while but I'm interested in HTTP/2 to avoid 503s in the typical setup of browser -> load balancer -> app where you regularly are deploying the app. HTTP/1.1 can't guarantee not getting 503s if the app processes roll whereas HTTP/2's shutdown protocol can. It only affects a small percentage of requests but isn't negligible in a high traffic site with regular deploys. Hopefully I'm not remembering the facts wrong on this one. |
Ah well now - that's a really pertinent anecdote. We've certainly got plenty we could be doing better in Uvicorn to help guide folks towards sensible engineering choices, rather than ooohhhh shiny. Uvicorn's played a helpful part in helping the ASGI ecosystem evolve. And "it's not slower that the tightly integrated server/framework approach" was an important part in arguing the case for ASGI. However at this point we can ease off on that messaging, with a view too...
|
Using the h2 package.
The text was updated successfully, but these errors were encountered: