Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
-
Upload
petabridge -
Category
Technology
-
view
599 -
download
0
Transcript of Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET
![Page 1: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/1.jpg)
@petabridge Petabridge.com
www.baynetug.org
Concurrency, Without the Pain: An Intro to Akka.NET
& the Actor Model with Andrew Skotzko
![Page 2: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/2.jpg)
@petabridge Petabridge.com
• www.baynetug.org • @baynetug / #BayNetUG • An open and independent forum for evaluating and
extending knowledge of .NET architecture, technologies, tools and business applications
• Monthly events (technical, business, networking) – Mountain View, San Francisco, Berkeley
• Working groups
Bay.NET User Group
![Page 3: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/3.jpg)
@petabridge Petabridge.com
.NET Community
San Francisco SQL Server User Group meetup.com/The-San-Francisco-SQL-Server-Meetup-Group
Azure Developers www.bayazure.org
San Francisco F# h"p://www.meetup.com/sfsharp/
![Page 4: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/4.jpg)
@petabridge Petabridge.com
Coming Soon
• San Francisco: Hello DocumentDB – Tuesday, September 15th – Microsoft, 555 California St
• SouthBay.Net: Unit Testing Makes Me Faster: 8/27 – German International School of SV
• Silicon Valley Code Camp: 10/3-4
– Evergreen Valley College
![Page 5: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/5.jpg)
@petabridge Petabridge.com
Concurrency Without the Pain
An Intro to Akka.NET & Actor Model
#AkkaDotNet @ #BayNetUG
Andrew Skotzko Co-‐founder — Petabridge
![Page 6: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/6.jpg)
@petabridge Petabridge.com
Why should we care about
concurrency?
![Page 7: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/7.jpg)
@petabridge Petabridge.com
1970 -‐ 2005
![Page 8: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/8.jpg)
@petabridge Petabridge.com
![Page 9: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/9.jpg)
@petabridge Petabridge.com
![Page 10: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/10.jpg)
@petabridge Petabridge.com
![Page 11: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/11.jpg)
@petabridge Petabridge.com
![Page 12: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/12.jpg)
@petabridge Petabridge.com
![Page 13: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/13.jpg)
@petabridge Petabridge.com
![Page 14: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/14.jpg)
@petabridge Petabridge.com
TANSTAAFL “There ain’t no such thing as a free lunch.” —R. A. Heinlein, The Moon Is a Harsh Mistress
![Page 15: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/15.jpg)
@petabridge Petabridge.com
What the hell are you talking about?
![Page 16: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/16.jpg)
@petabridge Petabridge.com
Concurrency.
We needs it.
![Page 17: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/17.jpg)
@petabridge Petabridge.com
So why is this hard?
![Page 18: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/18.jpg)
@petabridge Petabridge.com
How to Write Multithreaded Code
![Page 19: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/19.jpg)
@petabridge Petabridge.com
Shared State Programming Sucks (Illustrated)
![Page 20: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/20.jpg)
@petabridge Petabridge.com
Random?
• .NET 4.0: TPL (2010) • .NET 4.5: async/await (2012)
![Page 21: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/21.jpg)
@petabridge Petabridge.com
Is there a better way? THERE MUST BE! THERE. MUST. BE. A. BETTER. WAY!
![Page 22: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/22.jpg)
@petabridge Petabridge.com
Warning! Mind Blowingly Different
Programming Style Ahead!
![Page 23: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/23.jpg)
@petabridge Petabridge.com
Warning! Mind Blowingly Different Programming Style Ahead!
![Page 24: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/24.jpg)
@petabridge Petabridge.com
The Actor Model
![Page 25: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/25.jpg)
@petabridge Petabridge.com
What is the actor model?
![Page 26: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/26.jpg)
@petabridge Petabridge.com
Everything is an actor.
![Page 27: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/27.jpg)
@petabridge Petabridge.com
![Page 28: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/28.jpg)
@petabridge Petabridge.com
![Page 29: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/29.jpg)
@petabridge Petabridge.com
3 Core Abilities
1. Send messages 2. Create other actors 3. Change behavior
![Page 30: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/30.jpg)
@petabridge Petabridge.com
Messages
![Page 31: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/31.jpg)
@petabridge Petabridge.com
Actors work by passing each other messages
![Page 32: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/32.jpg)
@petabridge Petabridge.com
Message passing in action
![Page 33: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/33.jpg)
@petabridge Petabridge.com
BUZZWORD BINGO!
![Page 34: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/34.jpg)
@petabridge Petabridge.com
Example Akka.NET Message
![Page 35: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/35.jpg)
@petabridge Petabridge.com
Actors send messages to addresses
![Page 36: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/36.jpg)
@petabridge Petabridge.com
Actor addresses have location transparency
![Page 37: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/37.jpg)
@petabridge Petabridge.com
Which means…
![Page 38: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/38.jpg)
@petabridge Petabridge.com
![Page 39: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/39.jpg)
@petabridge Petabridge.com
![Page 40: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/40.jpg)
@petabridge Petabridge.com
ReactiveManifesto.org
![Page 41: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/41.jpg)
@petabridge Petabridge.com
What is Akka.NET?
![Page 42: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/42.jpg)
@petabridge Petabridge.com
Battle-Tested (JVM)
![Page 43: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/43.jpg)
@petabridge Petabridge.com
This is an actor
![Page 44: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/44.jpg)
@petabridge Petabridge.com
These are messages
![Page 45: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/45.jpg)
@petabridge Petabridge.com
Actors run on threads
![Page 46: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/46.jpg)
@petabridge Petabridge.com
Actors are lazy
![Page 47: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/47.jpg)
@petabridge Petabridge.com
Process messages one at a time
![Page 48: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/48.jpg)
@petabridge Petabridge.com
The circle of life
![Page 49: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/49.jpg)
@petabridge Petabridge.com
![Page 50: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/50.jpg)
@petabridge Petabridge.com
Hierarchies
![Page 51: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/51.jpg)
@petabridge Petabridge.com
Supervision
![Page 52: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/52.jpg)
@petabridge Petabridge.com
Switchable Behavior
![Page 53: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/53.jpg)
@petabridge Petabridge.com
And Can Form Highly Available Systems
![Page 54: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/54.jpg)
@petabridge Petabridge.com
What’s this give me?
![Page 55: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/55.jpg)
@petabridge Petabridge.com
Where can I use this? • Analytics systems • Marketing automation • Multi-player games • Device / IoT tracking • Alerting & monitoring systems • Recommendation engines • Dynamic pricing • Microservices • Reactive UI
![Page 56: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/56.jpg)
@petabridge Petabridge.com
DEMO
![Page 57: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/57.jpg)
@petabridge Petabridge.com
hZp://LearnAkka.net
![Page 59: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/59.jpg)
@petabridge Petabridge.com
Hierarchies pt. deux
![Page 60: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/60.jpg)
@petabridge Petabridge.com
Character Actor Pattern
![Page 61: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/61.jpg)
@petabridge Petabridge.com
ActorSelection == selection by address
![Page 62: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/62.jpg)
@petabridge Petabridge.com
Actor lifecycle
![Page 63: Concurrency, Without the Pain: An Intro to Akka.NET @ Bay.NET](https://reader035.fdocuments.in/reader035/viewer/2022062412/58f2910a1a28ab80168b45b9/html5/thumbnails/63.jpg)
@petabridge Petabridge.com
Actor lifecycle