3 ms·
Async models are idiomatic for high-performance server code regardless of the programming language, particularly for anything I/O or concurrency intensive. The
by jandrewrogers 5y ago
Async models are idiomatic for high-performance server code regardless of the programming language, particularly for anything I/O or concurrency intensive. The reason people use thread-per-core software architectures, which naturally require an async model, is because they have much higher throughput than the alternatives.
If software performance, efficiency, and scalability are primary objectives, you are going to be writing a lot of async code in a systems language like Rust or C++. People that “know what they are doing” understand this and why. Hence the interest in async libraries for Rust.
- MuffinFlavored 5y agocan you take code that is blocking in nature and make it async (like an FFI dlsym call), or at a low level does that just boil down to lots of polling/timers?
- vlovich123 5y agoNot sure what code you’re looking at but in reality all code is asynchronous by nature (ie you ask the HW to do something and it tells you it’s done some time later). Then we layer blocking syscalls on top and then you layer async underneath. Io_uring is an attempt at getting everything asynchronous top to bottom. Some times we use polling if there’s sufficient traffic and interrupts are inefficient but that’s still asynchronous, just batched.
- weq 5y agohttp://think-async.com/Asio/asio-1.5.3/doc/asio/overview/core/async.html http://think-async.com/Asio/asio-1.5.3/doc/asio/overview/cor...
- errantmind 5y agoThe GP mentioned "async runtimes". There are other approaches to async that don't involve using an async runtime, like epoll / kqueue. I personally prefer writing synchronous code, running in multiple threads pulling from a shared work queue. It isn't a one-size-fits-all solution but it is widely applicable, and you get to avoid the complexity of writing 'async code'
- alexchamberlain 5y agoAsync runtimes are just wrappers around the underlying async technology, like epoll, kqueue and io_uring. They give structure in a similar way if/for/while put structure around the underlying PC jumps.
- errantmind 5y agoYes, but they also introduce a lot of complexity to the developer experience. It is turtles all the way down with async code, as they say
- otabdeveloper4 5y ago> ...is because they have much higher throughput than the alternatives You're equating "high-performance" with "throughput". This is a classic newbie mistake and exactly what I mean when I mention cargo-cult.