Slides for my webinar.
View Slide
2Deep-dive in async/await bei Backend-APIs▪ 🐻💬▪▪▪▪▪▪▪▪ Twitter:
3▪▪▪▪▪Deep-dive in async/await bei Backend-APIs
4▪▪▪▪▪▪Deep-dive in async/await bei Backend-APIs
5Deep-dive in async/await bei Backend-APIsNein, aber effizienter!
6Deep-dive in async/await bei Backend-APIs
7▪▪▪▪▪▪▪Deep-dive in async/await bei Backend-APIs
8Deep-dive in async/await bei Backend-APIsKern 1 Kern 2 Kern 3 Kern 4P2 T1P2 T2P3 T1P1 T2P3 T2OS SchedulerP1 T1
9•••▪▪▪▪▪Deep-dive in async/await bei Backend-APIs* Zahlen für Windows, Quelle: “Windows Internals“, Solomin, Russinovich et al.Jeffrey Richter sagt hingegen: 30 ms in Windows, Linux hat andere Zeiten…
10••••••••••Deep-dive in async/await bei Backend-APIs
11Deep-dive in async/await bei Backend-APIsKern 1Kern 2Kern 3Kern 4P2 T1P2 T2P3 T1P1 T1P3 T2P1 T2Kontext-WechselKontext- & Prozess-Wechsel
12•••••••••Deep-dive in async/await bei Backend-APIs
13Deep-dive in async/await bei Backend-APIsALU & FPURegisters 0Registers 1CPU Core withHyper-ThreadingClassic CPU Core
14Deep-dive in async/await bei Backend-APIsKern 1Kern 2Kern 3Kern 4P2 T1P2 T2MyProc T1P1 T2P1 T1MyProc T2MyProc T3MyProc T4MyProc T5MyProc T7MyProc T6
15Deep-dive in async/await bei Backend-APIs•••Quelle: “Systems Performance: Enterprise and the Cloud“, 2013, Brendan Gregg, Pearson Verlag
16Deep-dive in async/await bei Backend-APIs••••••
17Deep-dive in async/await bei Backend-APIs
18▪▪▪▪▪▪ ⏳▪▪▪Deep-dive in async/await bei Backend-APIsReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile
19▪▪▪▪▪▪ ⏳▪Deep-dive in async/await bei Backend-APIsReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile
20Deep-dive in async/await bei Backend-APIs
21Deep-dive in async/await bei Backend-APIs•• IAsyncResult BeginSomething()• EndSomething(result)•• DoSomethingAsync()• event SomethingCompleted•• Task[] DoSomethingAsync()P
22Deep-dive in async/await bei Backend-APIs
23•••••• .ContinueWith()•Deep-dive in async/await bei Backend-APIs
24Deep-dive in async/await bei Backend-APIsTaskTask-ListeThreadpool T1Threadpool T2Kern 1Kern 3Kern 2Kern 4Threadpool T3Threadpool T4 ThreadpoolManagementJeder Pool-Threadarbeitet Tasks in einerEndlosschleife abCompletedTasks
25••••• 🤯••Deep-dive in async/await bei Backend-APIs
26Deep-dive in async/await bei Backend-APIs
27•• async Task<> MyMethodAsync()••• await OtherMethodAsync()•• await••••Deep-dive in async/await bei Backend-APIsE
28Deep-dive in async/await bei Backend-APIs
29Deep-dive in async/await bei Backend-APIsP
30•• task.GetAwaiter().GetResult() → ❌• Thread.Sleep() → ❌• await Task.Delay() → ✔• Thread.SpinWait()• → ❌• → ✔Deep-dive in async/await bei Backend-APIs
31•• var task1 = DoSomethingAsync();var task2 = DoSomethingElseAsync();await Task.WhenAll(task1, task2);••• Task.Factory.StartNew(…, TaskCreationOptions.LongRunning);•••Deep-dive in async/await bei Backend-APIs
32••••Deep-dive in async/await bei Backend-APIs
33Deep-dive in async/await bei Backend-APIs
34▪▪▪▪▪▪Deep-dive in async/await bei Backend-APIs
35▪▪▪▪▪😉Deep-dive in async/await bei Backend-APIsP