Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BASTA! Spring 2022 - Web-APIs mit Async & Await

BASTA! Spring 2022 - Web-APIs mit Async & Await

Slides für meinen Vortrag auf der BASTA! Spring 2022.

Avatar for Sebastian Gingter

Sebastian Gingter

February 22, 2022
Tweet

More Decks by Sebastian Gingter

Other Decks in Programming

Transcript

  1. 3 ▪ 🐻💬 ▪ ▪ ▪ ▪ ▪ ▪ ▪

    ▪ Twitter: Wobei hilft‘s und wie funktioniert‘s?
  2. Special Day “Modern Business Applications” Thema Sprecher Datum, Uhrzeit Web-APIs

    mit async/await: Wobei hilft’s und wie funktioniert’s? Sebastian Gingter DI, 22. Februar 2022, 10.45 bis 11.45 Web Components in modernen Web-Apps: Hype oder Heilsbringer? Peter Kröner DI, 22. Februar 2022, 12.15 bis 13.15 Produktivitäts-PWAs mit Angular auf Desktopniveau Christian Liebel DI, 22. Februar 2022, 14.30 bis 15.30 Blazor WebAssembly in der Praxis: 5 Dinge, die Sie kennen sollten Christian Weyer DI, 22. Februar 2022, 16.00 bis 17.00 Serverless Kubernetes mit Azure Container Apps Thorsten Hans DI, 22. Februar 2022, 18.00 bis 19.00
  3. 11 • • • ▪ ▪ ▪ ▪ ▪ *

    Zahlen für Windows, Quelle: “Windows Internals“, Solomin, Russinovich et al. Jeffrey Richter sagt hingegen: 30 ms in Windows, Linux hat andere Zeiten… Wobei hilft‘s und wie funktioniert‘s?
  4. 12 • • • • • • • • •

    • Wobei hilft‘s und wie funktioniert‘s?
  5. 13 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 Wobei hilft‘s und wie funktioniert‘s?
  6. 14 • • • • • • • • •

    Wobei hilft‘s und wie funktioniert‘s?
  7. 15 ALU & FPU Registers 0 Registers 1 CPU Core

    with Hyper-Threading Classic CPU Core Wobei hilft‘s und wie funktioniert‘s?
  8. 16 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 Wobei hilft‘s und wie funktioniert‘s?
  9. 17 • • • Quelle: “Systems Performance: Enterprise and the

    Cloud“, 2013, Brendan Gregg, Pearson Verlag Wobei hilft‘s und wie funktioniert‘s?
  10. 20 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ ▪

    ▪ ReadFile API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile Wobei hilft‘s und wie funktioniert‘s?
  11. 21 ▪ ▪ ▪ ▪ ▪ ▪ ⏳ ▪ ReadFile

    API: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile Wobei hilft‘s und wie funktioniert‘s?
  12. 23 • • IAsyncResult BeginSomething() • EndSomething(result) • • DoSomethingAsync()

    • event SomethingCompleted • • Task[<T>] DoSomethingAsync() Wobei hilft‘s und wie funktioniert‘s?
  13. 25 • • • • • • .ContinueWith() • Wobei

    hilft‘s und wie funktioniert‘s?
  14. 26 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 Wobei hilft‘s und wie funktioniert‘s?
  15. 27 • • • • • 🤯 • • Wobei

    hilft‘s und wie funktioniert‘s?
  16. 29 • • async Task<> MyMethodAsync() • • • await

    OtherMethodAsync() • • await • • • • Wobei hilft‘s und wie funktioniert‘s?
  17. 32 • • task.GetAwaiter().GetResult() → ❌ • Thread.Sleep() → ❌

    • await Task.Delay() → ✔ • Thread.SpinWait() • → ❌ • → ✔ Wobei hilft‘s und wie funktioniert‘s?
  18. 33 • • var task1 = DoSomethingAsync(); var task2 =

    DoSomethingElseAsync(); await Task.WhenAll(task1, task2); • • • Task.Factory.StartNew(…, TaskCreationOptions.LongRunning); • • • Wobei hilft‘s und wie funktioniert‘s?