orleans – a “cloud native” runtime built for #azure
DESCRIPTION
TRANSCRIPT
![Page 1: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/1.jpg)
Orleans – A “cloud native” Runtime Built
for #AzureBy Alexandre Brisebois
@Brisebois http://bit.ly/[email protected]
![Page 2: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/2.jpg)
Forget about 3-tier architectures They don’t scale!
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 3: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/3.jpg)
Forget about 3-tier architectures They don’t scale!• Stateless frontends• Stateless middle tier• Storage is the bottleneck• Latency• Throughput• Scalability
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 4: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/4.jpg)
Forget about 3-tier architectures They don’t scale!• Much better performance• Lost semantics of storage• Lost concurrency control
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 5: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/5.jpg)
High-scale interactive services demand high throughput with low latency and high availability.
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 6: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/6.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 7: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/7.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 8: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/8.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 9: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/9.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 12: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/12.jpg)
Meet Actors They enable applications to attain high performance, reliability and scalability
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 13: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/13.jpg)
Start thinking in terms of Actors
• Performance of cache• Riche semantics• Concurrency control• Horizontal calls are natural• OOP paradigm• But there are still challenges
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 14: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/14.jpg)
Challenges with Actor Model Frameworks• Too low level• App manages lifecycle of actors, exposed to distributed races• App has to deal with actor failures, supervision trees• App manages placement of actors – resource management
• Developer has to be a distributed systems expert
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 15: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/15.jpg)
Welcome to Orleanshttps://orleans.codeplex.com@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 16: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/16.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 17: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/17.jpg)
Distributed Actor runtime• Virtual Actor model• Location transparency
Built for .Net• Actors are .Net objects• Messaging through .Net interfaces• Asynchronous through async/await in C#• Automatic error propagation
Runtime execution container• Implicit activation & lifecycle management• Coordinated placement• Multiplexed communication• Failure recovery
Actor
Runtime
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 19: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/19.jpg)
Grains
Grain Type Grain (Instance) Grain Activation
Game Grain Type
Game Grain (Instance) #2,548,308
Game Grain (Instance) #2,031,769
Game Grain #2,548,308Activation #1 @ 192.168.1.1
Game Grain #2,031,769Activation #1 @ 192.168.1.5
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 20: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/20.jpg)
Grains: Virtual actors
• Grain instances always exist, virtually• Needn’t be created, looked up or deleted• Code can always call methods the grain• Grains never fail
• Activations are created on-demand• If there is no existing activation, a message sent to it triggers instantiation• Lifecycle is managed by the runtime• Transparent recovery from server failures• Runtime can create multiple activations of stateless grains (for performance)
• Location transparency• Grains can pass references to one another around• References can be persisted to cold-storage
http://bit.ly/1lc9W3B [email protected]@Brisebois
![Page 21: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/21.jpg)
Concurrency is hard!Distribution, high throughput and low-latency make it even harderGrains are Single Threaded
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 22: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/22.jpg)
Grain execution model
•Activations are single-threaded• Optionally re-entrant• Runtime schedules execution of methods• Multiplexed across threads
•No shared state• Avoid races• No need for locks
•Cooperative multitasking
http://bit.ly/1lc9W3B [email protected]@Brisebois
![Page 23: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/23.jpg)
Grain Activations reside in SilosThink of Silos as virtual memory (RAM)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 25: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/25.jpg)
Stateful Grain Instances reside in cold storageThe Activation (state) can be persisted to cold storage
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 27: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/27.jpg)
public interface IHello : IGrain{ Task<string> SayHello(string greeting);}
Grain interfacesMarker interface to indicate grain interfaces
All grain interface methods must be asynchronous
![Page 28: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/28.jpg)
public class HelloGrain : GrainBase, IHello{ Task<string> SayHello(string greeting) { var resp = "You said: '" + greeting + "', I say: Hello!"; return Task.FromResult(resp); }}
Implementing the grain type
![Page 29: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/29.jpg)
private async static Task SendMessage(long grainId) { IHello friend = HelloFactory.GetGrain(grainId); string response = await friend.SayHello("Good morning!"); Console.WriteLine("Response: {0}", response);}
Talking to grainsFactory Class is auto-generated at compile time
Grain Id (long , GUID or String)
![Page 31: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/31.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 32: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/32.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 33: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/33.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 34: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/34.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 36: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/36.jpg)
Common characteristics• Large numbers of independent actors
• Free-form relations
• High throughput/low latency• These generally dictate stateful compute
• Fine-Grained partitioning is natural
• Cloud-based scale-out & elasticity
• Much broader developer audience
Orleans was built for…
Scenarios• Social graphs
• Mobile backend
• Internet of things
• Real-time analytics
• ‘Intelligent’ cache
• Interactive entertainment
![Page 37: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/37.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 38: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/38.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 39: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/39.jpg)
@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 40: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/40.jpg)
A cloud native runtime
New Silo
Unavailable Silo
New Activation New Activations
![Page 41: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/41.jpg)
What does Orleans bring to cloud services in Azure?
@Brisebois http://bit.ly/1lc9W3B [email protected]
• A powerful Virtual Actor concept• Familiar programming model• Smooth learning curve for developers new to asynchronous
programming
![Page 42: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/42.jpg)
What does Orleans bring to cloud services in Azure?
@Brisebois http://bit.ly/1lc9W3B [email protected]
• Faster development through separation of concerns (OOP)• Makes cloud-scale programming attainable
![Page 43: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/43.jpg)
What does Orleans bring to cloud services in Azure?
@Brisebois http://bit.ly/1lc9W3B [email protected]
• Uncompromised performance• Scalability by default• Fewer concurrency hazard concerns and headaches• Simplified failure handling through error propagation
![Page 44: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/44.jpg)
Scalability by default??
@Brisebois http://bit.ly/1lc9W3B [email protected]
• Near linear scaling to hundreds of thousands of requests per second• Efficient resource usage• Location transparency simplifies
scaling up or down• Complements Azure PaaS• Easily adjust scale over time
Test Lab Numbers
![Page 45: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/45.jpg)
Orleans – A “cloud native” Runtime Built
for #AzureBy Alexandre Brisebois
@Brisebois http://bit.ly/[email protected]
![Page 46: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/46.jpg)
Using Orleans to Build Halo 4’s Distributed Cloud Services in Azure
http://bit.ly/1g6V5c3@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 47: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/47.jpg)
Tackle Distribution, High Throughput and Low-Latency with Orleans – A “cloud native” Runtime Built for #Azure
http://bit.ly/1og5ZOI@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 48: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/48.jpg)
Orleans: Distributed Virtual Actors for Programmability and Scalability
http://bit.ly/1gkv43A@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 49: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/49.jpg)
Orleans: Cloud Computing for Everyone
http://bit.ly/QqiUik@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 50: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/50.jpg)
Orleans: A Framework for Cloud Computing
http://bit.ly/1hDX4j0@Brisebois http://bit.ly/1lc9W3B [email protected]
![Page 52: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/52.jpg)
Devices send telemetry to the Cloud
Per-device actors process andpre-aggregate incoming data
Multi-level aggregation by actors
Statistics, predictive analytics, fraud detection, etc.
Control channel back to devices
Grouping by location, category, etc.
Elastically scales with # of devices
[Near] real-time analytics
![Page 53: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/53.jpg)
Actors hold cache values
Semantic operation on values
Function shipping (method calls)
Coordination across multiple values
Transparent on-demand reactivation
Write-through cache with optional batching
Intelligent cache
![Page 55: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/55.jpg)
Near-real-time processing
State is mostly in memory
Constantly evolving social graph
A fraction of total user base online
Very high throughput, low latency
Inherent races
Presence service
Game Session Grain A
Game Session Grain B
Game Session Grain C
Player Grain X
Player Grain Y
Player Grain Z
Presence(Router)Grains
GameClient
MobileClient
![Page 56: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/56.jpg)
Heartbeat
Game Session Grain A
Game Session Grain B
Game Session Grain C
Player Grain X
Player Grain Y
Player Grain Z
Presence(Router)Grains
GameClient
MobileClient
![Page 57: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/57.jpg)
Update game status
Game Session Grain A
Game Session Grain B
Game Session Grain C
Player Grain X
Player Grain Y
Player Grain Z
Presence(Router)Grains
GameClient
MobileClient
![Page 58: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/58.jpg)
Player grain
Game Session Grain A
Game Session Grain B
Game Session Grain C
Player Grain X
Player Grain Y
Player Grain Z
Presence(Router)Grains
GameClient
MobileClient
![Page 59: Orleans – a “cloud native” runtime built for #azure](https://reader035.vdocuments.us/reader035/viewer/2022062417/54b613db4a7959943f8b4801/html5/thumbnails/59.jpg)
Client observer
Game Session Grain A
Game Session Grain B
Game Session Grain C
Player Grain X
Player Grain Y
Player Grain Z
Presence(Router)Grains
GameClient
MobileClient