Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
BASTA! 2021 - Deep Dive in async/await bei Backend-APIs
Search
Sebastian Gingter
September 21, 2021
Programming
0
210
BASTA! 2021 - Deep Dive in async/await bei Backend-APIs
Slides zu meinem Vortrag auf der BASTA! 2021.
Sebastian Gingter
September 21, 2021
Tweet
Share
More Decks by Sebastian Gingter
See All by Sebastian Gingter
Generative AI: Semantische Suche und LLMs jenseits des Hello World-RAG-Tutorials
phoenixhawk
0
22
Webinar: Moderne Semantische Suche mit LLMs, Vektor-Datenbanken und LangChain
phoenixhawk
0
190
BASTA 2023 Blazor Statemanagement
phoenixhawk
0
33
.NET 7 Web-APIs mit Turbo: Deep-Dive in async/await
phoenixhawk
0
230
Turbopower - Ein Blick unter die Haube der .NET 7 Performance-Optimierungen
phoenixhawk
0
95
BASTA! Spring 2023 - .NET 7 Performanceoptimierungen unter der Lupe
phoenixhawk
0
76
Webinar: Blazor Webassembly - State Management in der Praxis
phoenixhawk
0
620
BASTA! Spring 2022 - Web-APIs mit Async & Await
phoenixhawk
0
1k
Thinktecture Webinar: Web-API mit Turbo:Deep-dive in async/awaitfür Backend-APIs
phoenixhawk
0
830
Other Decks in Programming
See All in Programming
Anthropic Cookbook のおすすめレシピ
schroneko
7
980
Code Reviews
bkuhlmann
4
890
Netty Chicago Java User Group 2024-04-17
sullis
0
180
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
4.1k
Fragment Composition of GraphQL
quramy
7
1k
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
340
What We Can Learn From OSS
inouehi
0
420
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
ONE WEDGE_company_guide
1wedge_one
0
490
Apache Hive 4 on Treasure Data
ryukobayashi
0
330
PHPはいつから死んでいるかの調査
chiroruxx
1
400
Fast JSX: Don't clone props object #28768
yossydev
1
120
Featured
See All Featured
The Invisible Side of Design
smashingmag
294
49k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
60
14k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
Testing 201, or: Great Expectations
jmmastey
28
6.4k
Agile that works and the tools we love
rasmusluckow
325
20k
Code Reviewing Like a Champion
maltzj
514
39k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
KATA
mclloyd
15
12k
Designing with Data
zakiwarfel
96
4.8k
Rails Girls Zürich Keynote
gr2m
91
13k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
Transcript
Thinktecture AG | Consultant
3 Deep-dive in async/await bei Backend-APIs
4 Deep-dive in async/await bei Backend-APIs ▪ ▪ ▪ ▪
▪ ▪ ▪ ▪ ▪ Twitter:
5 ▪ ▪ ▪ ▪ ▪ Deep-dive in async/await bei
Backend-APIs
6 ▪ ▪ ▪ ▪ ▪ ▪ Deep-dive in async/await
bei Backend-APIs
7 Deep-dive in async/await bei Backend-APIs Nein, aber effizienter!
8 Deep-dive in async/await bei Backend-APIs
9 ▪ ▪ ▪ ▪ ▪ ▪ ▪ Deep-dive in
async/await bei Backend-APIs
10 Deep-dive in async/await bei Backend-APIs Kern 1 Kern 2
Kern 3 Kern 4 P2 T1 P2 T2 P3 T1 P1 T2 P3 T2 OS Scheduler P1 T1
11 • • • ▪ ▪ ▪ ▪ ▪ 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…
12 • • • • • • • • •
• Deep-dive in async/await bei Backend-APIs
13 Deep-dive in async/await bei Backend-APIs Kern 1 Kern 2
Kern 3 Kern 4 P2 T1 P2 T2 P3 T1 P1 T1 P3 T2 P1 T2 Kontext- Wechsel Kontext- & Prozess- Wechsel
14 • • • • • • • • •
Deep-dive in async/await bei Backend-APIs
15 Deep-dive in async/await bei Backend-APIs ALU & FPU Registers
0 Registers 1 CPU Core with Hyper-Threading Classic CPU Core
16 Deep-dive in async/await bei Backend-APIs Kern 1 Kern 2
Kern 3 Kern 4 P2 T1 P2 T2 MyProc T1 P1 T2 P1 T1 MyProc T2 MyProc T3 MyProc T4 MyProc T5 MyProc T7 MyProc T6
17 Deep-dive in async/await bei Backend-APIs • • • Quelle:
“Systems Performance: Enterprise and the Cloud“, 2013, Brendan Gregg, Pearson Verlag
18 Deep-dive in async/await bei Backend-APIs • • • •
• •
19 Deep-dive in async/await bei Backend-APIs
20 • • • • • • .ContinueWith() • Deep-dive
in async/await bei Backend-APIs
21 Deep-dive in async/await bei Backend-APIs Task Task-Liste Threadpool T1
Threadpool T2 Kern 1 Kern 3 Kern 2 Kern 4 Threadpool T3 Threadpool T4 Threadpool Management Jeder Pool-Thread arbeitet Tasks in einer Endlosschleife ab Completed Tasks
22 • • • • • 🤯 Deep-dive in async/await
bei Backend-APIs
23 Deep-dive in async/await bei Backend-APIs
24 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ ▪
▪ Deep-dive in async/await bei Backend-APIs ReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile
25 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ Deep-dive
in async/await bei Backend-APIs ReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile
26 Deep-dive in async/await bei Backend-APIs • • IAsyncResult BeginSomething()
• EndSomething(result) • • DoSomethingAsync() • event SomethingCompleted • • Task[<T>] DoSomethingAsync()
27 Deep-dive in async/await bei Backend-APIs
28 • • async Task<> MyMethodAsync() • • • await
OtherMethodAsync() • • await • • • • Deep-dive in async/await bei Backend-APIs
29 Deep-dive in async/await bei Backend-APIs
30 Deep-dive in async/await bei Backend-APIs
31 • • task.GetAwaiter().GetResult() → ❌ • Thread.Sleep() → ❌
• await Task.Delay() → ✔ • Thread.SpinWait() • → ❌ • → ✔ Deep-dive in async/await bei Backend-APIs
32 • • var task1 = DoSomethingAsync(); var task2 =
DoSomethingElseAsync(); await Task.WhenAll(task1, task2); • • • Task.Factory.StartNew(…, TaskCreationOptions.LongRunning); • • • Deep-dive in async/await bei Backend-APIs
33 • • • • Deep-dive in async/await bei Backend-APIs
34 Deep-dive in async/await bei Backend-APIs
35 ▪ ▪ ▪ ▪ ▪ ▪ Deep-dive in async/await
bei Backend-APIs
36 ▪ ▪ ▪ ▪ ▪ 😉 Deep-dive in async/await
bei Backend-APIs
None