8 ms·
Tokio: Runtime for writing reliable asynchronous applications with Rust
- eximius 6y agoWas there a new release? Just raising awareness of it's existence?
- carllerche 6y agoHi! Tokio maintainer here. I'm surprised (in a good way) to see this posted to HN today. Nothing big is happening this week. That said, I'm always happy to answer questions.
- onei 6y agoOne of the things that puts me off investing in Rust day-to-day is the lack of v1 packages in areas like this. I notice I'm not alone based on the results of the annual Rust survey. What do you imagine v1 will look like for Tokio compared to today and when would you envisage it landing?
- carllerche 6y agoWe're aiming for 1.0 by Q3 2020. I wrote a bit about it here: https://tokio.rs/blog/2019-11-tokio-0-2/#a-roadmap-to-1-0 https://tokio.rs/blog/2019-11-tokio-0-2/#a-roadmap-to-1-0 That said, io_uring may end up impacting that target by a little bit. I understand the sentiment re v1. In reality, Tokio v0.1 was pretty much 1.0. We never cut 1.0 because async/await was in the works and it was unclear when it would be released. Now that async/await is out, 0.2 was a big change. We need some time to stabilize our APIs and collect user feedback. This process is happening now and going well.
- carlmr 6y agoAs someone who has dabbled in Rust, I think the Rustaceans are just too careful to bump something up to v1 before it's near perfect. In other languages the package ecosystem looks more mature because people are less careful in bumping up numbers.
- carllerche 6y agoYou aren't wrong. In hindsight, we should have shipped 1.0 a year or so after v0.1. I don't think we can ship 2.0 now. v0.3 is going to happen soon to fix errors in v0.2. async/await in Rust is very new. We are still figuring things out.
- naasking 6y agoI'm sure they look more mature, but they might leave a bad impression. Rust already has "bad PR" with the borrow checker, so libraries being more conservative before bumping versions might work in its favour. Otherwise you might get a bad impression from the language and apparently immature libraries.
- larntz 6y agoFor me the borrow checker is what I find interesting about rust. I wouldn't call it bad pr.
- naasking 6y agoThe people talking about it generally complain about it. Those comfortable with it generally aren't talking about it. I don't know what else to call that than bad PR. Just the nature of the beast.
- michael_j_ward 6y agoHave you discussed elsewhere about io_uring plans? It isn't mentioned at all in the linked roadmap
- carllerche 6y agoWe are still figuring that out. When I wrote that post, uring was not yet working with sockets. Things have changed. We are exploring the space.
- andrenth 6y agoIs there anywhere I can read about the plans for io_uring integration?
- pornel 6y agoBTW, Rust ecosystem has a fear of calling things 1.0. In the Rust world "1.0" often doesn't mean the first stable release, but more like "done". There are plenty of crates that are stable and production-ready, but with 0.x versions. In some cases ironically authors don't want to bump the version to 1.0, because the crates are so widely used and stable, that the mere version bump would be an unnecessarily big change (e.g. the most used libc crate will likely stay as v0.2 forever).
- remram 6y agoasync-std, their main competitor, is 1.5.0
- vasilakisfil 6y agowhat's the case with async-std? Do the tokio devs have meetings with async-std regarding common problems they are facing, and is there any chance of merging those 2 projects, since in my humble opinion, seems like they solve the same problem pretty much ? edit: my question may not be formatted correctly, but basically I am asking whether there is cooperation between the 2 projects, or they are competing each other
- carllerche 6y agoGreat question. I'm not thinking about competing. All I care about is users and building a great library. I think the best way to advance the state of the ecosystem is by experimenting and shipping improvements. IMO Ideas are best shared as working code. The Tokio team has been very active on that front. Recently, we've shipped a new strategy to improve the cooperative scheduler (https://tokio.rs/blog/2020-04-preemption/ https://tokio.rs/blog/2020-04-preemption/), and a bunch of other new utilities (https://github.com/tokio-rs/tokio/releases/tag/tokio-0.2.12 https://github.com/tokio-rs/tokio/releases/tag/tokio-0.2.12, https://github.com/tokio-rs/tokio/releases/tag/tokio-0.2.11 https://github.com/tokio-rs/tokio/releases/tag/tokio-0.2.11). Standardization can be extracted once proven. This is how `std::future` came to be.
- zamalek 6y agoThe purpose of tokio was to add asynchronous support to Rust in the absence of async features (it predates them). It has since added std-like async interfaces. It is the most mature. async-std aims to do that last sentence as cleanly as possible, without having to support a legacy interface. I found it builds faster because of that and that's why I chose it. smol (the new kid in the block) aims to async-ify network types by simply wrapping them in Async<T>. It also aims to be as few lines of code as possible. They are all different approaches to the same problem. The ability to experiment with different approaches is precisely why Rust doesn't have a prescribed async runtime (or prescribed error types, or many other things). If merely solving the problem is all you care about, pick tokio. It should be able to use async-std crates, but async-std can't use it. smol can use anything but is a bit unproven.
- stjepang 6y ago
- jksmith 6y agoThis assembly programmer wants to know what bare-metal performance means in a HLL.
- carllerche 6y agoTokio should not add any overhead compared to writing an equivalent by hand with no abstractions. I'm a programmer, not a marketer :) Happy to take suggestions on the copy.
- pjmlp 6y agoThe same that an Assembly language that gets translated into CPU micro-ops and executed via microcode.
- cesarb 6y agoJust nitpicking, but that's not how a modern CPU works. The microcode does not execute the micro-ops, the microcode is used to generate micro-ops to be executed, and in fact most instructions don't even go through the microcode, which is used only for complex or rarely used instructions. Simpler instructions are decoded directly into micro-ops.
- diroussel 6y agoYes, it’s a strange phrase. Especially as we tend to execute software on silicon crystals, etched by light. The metal is just the dumb wiring.
- gaze 6y agoNo VM, no GC. Mostly zero cost abstractions.
- anderspitman 6y agoHow's async looking in Rust these days? About a year ago I wrote one service that's in production. I ended up doing a lot of the futures stuff by hand. Never really understood how the error mapping/conversions worked, and usually just fiddled with them until it compiled. I remember the docs being decent, but there wasn't a single book/site that had everything in a comprehensive and approachable manner. In spite of all that, the service has chugged along pretty nicely. Ultimately I've just been more productive in Go for the time being, but I remember definitely see the potential down the road for great things. Has async/await permeated the ecosystem? Is the book more fleshed out?
- carllerche 6y agoIt gets better every day. async/await is relatively new (stabilized end of last year). All the misc libs in the Tokio stack have been updated. There is Tonic for gRPC, Hyper/reqwest/warp for HTTP, ... these all work with async/await now. For docs, there are some now and I expect it to improve a lot throughout the year. We also just posted mini-redis as a larger "real world" example: https://github.com/tokio-rs/mini-redis https://github.com/tokio-rs/mini-redis
- anderspitman 6y agoVery nice. I used warp (awesome) for my service. Maybe I should update it to use async/await as an exercise.
- tick_tock_tick 6y agoIt's better but it suffers from the same poison aspect all async/await implementations do. https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...
- steveklabnik 6y agoYes. Engineering is all about tradeoffs. This is a downside, but it is made up for by all the upsides.
- cmckn 6y agoI'm a Rust noob, and I don't understand the relationship of Tokio and the language's async/await syntax. Is there a "reference implementation" of the runtime? Is Tokio or another runtime required for those keywords to do anything? I also found this blurb from the website to be confusing: > Zero-cost abstractions Tokio's run-time model adds no overhead compared to an equivalent system written entirely by hand. This sounds like Tokio's impl is comparable to other impl's of "the same" system, but how does it compare to "naked Rust"?
- Ralith 6y ago"system" here is intended to refer to the application using tokio, i.e. if you got rid of tokio and did everything by hand you wouldn't be able to make your application faster.
- cmckn 6y agoAhhh; thank you!
- aliceryhl 6y agoThe standard library currently only contains what is necessary to define _what_ a Future is. It contains no tools for actually executing them, and this is the role of Tokio.
- cmckn 6y agoVery cool, so I can choose my own impl. Does Tokio have a true competitor today? From my cursory look at some projects, Tokio shows up everywhere.
- fierro 6y agolegit name
- stjo 6y agoAs is tradition: I would like to inform the authors of this project there is a popular city with the same name. This can possibly create confusion
- deleted 6y ago[deleted]
- steveklabnik 6y agoWhile this is true, they are spelled differently.