Is Async Programming (Async/Await) Scalable?

preview_player
Показать описание
Async programming (promises, futures, tasks, async/await) and async messaging aren't the same things. The two concepts often get confused because of the naming, but they are very different. I'm going to cover the general idea of both and how one can prevent your system from grinding to a halt during high load.

🔗 EventStoreDB

💥 Join this channel to get access to source code & demos!

🔥 Don't have the JOIN button? Support me on Patreon!

0:00 Intro
0:43 Async Programming Models
2:54 Messaging
6:22 Differences

#softwarearchitecture #softwaredeveloper #codeopinion

Barbed wire icons created by Mehwish - Flaticon
Рекомендации по теме
Комментарии
Автор

Just for completeness: The async keyword is syntactic sugar for a state machine. The await keyword captures the task and yields the executing managed thread. It is a high level concept. In case of I/O work an I/O completion port (IOCP) will be registered in user mode. The idea is that the device driver’s interrupt service routine (kernel mode) is reacting to I/O packets from the driver and is responsible for completing the IOCP which calls back into the CLR/your application. In the meanwhile the managed thread can be used for other work and doesn't have to wait.

mahmutjomaa
Автор

Absolutely love the channel and all your insights. Keep up the awesome work!

rz
Автор

Async/reactive *doesn't* spin up threads; it should really be compared to the thread-per-request model, not messaging.

Rx is just async, nothing to do w/threads per se. RxJs is single threaded but reactive largely to deal w/user input and http responses concurrently. Observables could be coming from any source and are actually thread agnostic by design (its a pain point in java, no ThreadLocal for you!).

I would assume there's some kind of support for different c# 'async' bindings. Its largely syntactical sugar over destructuring a promise.

adambickford
Автор

Tasks (promises) are an interface choice..
Asynchronous messaging is an implementation detail.
I can wrap a message oriented backend implementation which uses an event callback as a response with a Task based interface (for example, using a TaskCompletionSource). I can even wrap it with a "synchronous" interface (no task, any callbacks handled behind the interface) if I really want to - not that I would want to.

allmhuran
Автор

so if the volume is nowhere near avaailable memory, it all works the same?

abj
Автор

So async await involves thread right? even though is just only IO based not cpu based?

thedacian
Автор

wheres the scalability part of async/await? code written async/await is scalable?

needtubes
Автор

4:50 This video was a little misleading, in most languages async/await doesn't block the thread during IO (it just saves the context) - that is kinda the whole point. I love your videos, but this one seems to be a little of an apples-to-oranges comparison. Messaging is about inter-process/service communication, asynchronous programming is about a single process using less resources, they aren't the same tool in the belt - and usually you use asynchronous programming with Messaging as well.

Tony-dprl