-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Drop tokio dependency #3767
Comments
It seems to me that some options are:
|
It's pretty easy to implement a oneshot channel with a mutex, especially if there is only one receiver. I'd say just implement it quickly in hyper itself. The main issue is that hyper usually pulls in h2, which depends on tokio for a lot more than synchronization primitives. So I'm not sure what the practical effect of this would be. |
My understanding is that right now, there isn't any http implementation with few dependencies that can be integrated into many executors. Even |
And, from a quick look, perhaps the goal of dropping tokio as a dependency for
Everything is |
Agreed. Even just having an HTTP/1 implementation would be nice. |
Just a stranger randomly landing on this issue, but you could also consider the |
Thanks for looking into this.
This change likely would not have as big an impact as it appears. hyper only enables the
I'm not likely to be inclined to do that. The implementation in Tokio is very well tested and optimized. Part of keeping hyper safe is vetting its dependencies. I wouldn't want to switch to another dependency that doesn't have the same level of testing, and more importantly, active maintainers able to fix things if a problem is found.
I'd like to clear that up. hyper is indeed a good choice for any runtime. It's been able to support bringing your own runtime for a while, and with hyper v1, we made that even more supported. That it happens to use Tokio for some channels should not affect working with any other runtime. That's because Tokio's |
Interesting! Clearly
compared to without tokio:
So I think dropping the tokio dependency makes a small difference, but definitely it's not dramatic as I thought.
That makes sense. Would you be open to a PR that pulled out the tokio implementation? I'd understand if in your judgement it's not worth it.
Heard! Thank you for the work that went into making that the case! Seeing the dependency on tokio is kind of a red flag, but clearly that doesn't have the impact on compile-time or on run-time that one might expect from "pulling in a whole 'nother executor". |
can we also drop the `Send + 'static' requirement if we were to drop tokio dependency to support thread per core runtimes better. |
Just to clarify, most all runtimes are thread per core, in that they create one thread per core of the machine (Tokio does this). A clearer term is shared-nothing.
That's not coming from Tokio being used. hyper happens to use a synchronization type from Tokio, but that does not affect |
Now that hyper uses its own traits instead of tokios (#3110, #3230), the only place that tokio is used is to provide
tokio::sync::oneshot::Receiver
insrc/upgarde.rs
. If we could find a way to implement this functionality without tokio's oneshot, we could drop the dependency entirely. This would have a pretty huge impact on the transitive dependencies we pull in everywhere hyper is used: from this:to this:
I also think this would make hyper more appealing to use with other executors like
smol
@notgull.The text was updated successfully, but these errors were encountered: