240 likes | 260 Views
Scalable By Design The Orleans Actor Framework for Azure. @ johnazariah @ maheshkrishnan. Get your idea to market fast! Scale on-demand Drag the slider to the right AutoScale No need to manage underlying machines Economies of scale. Why Are We Going To The Cloud?. Latency. Scalable.
E N D
Scalable By DesignThe Orleans Actor Framework for Azure @johnazariah @maheshkrishnan
Get your idea to market fast! • Scale on-demand • Drag the slider to the right • AutoScale • No need to manage underlying machines • Economies of scale Why Are We Going To The Cloud?
Latency Scalable Unpredictability Challenges Errors Decoupled Responsive Performance Concurrency Load Resilient Failure Unreliability Data Consistency
Typical 3-tier architecture Database is coordination layer Poor data locality Slow reads -> add a cache More complexity Cache Invalidation is hard Concurrency bugs Fine for single-user applications! Coding Like You’re The Only One Around
Make the middle-tier stateful Coordinate in the middle-tier instead of database Lazily load objects from database Single authority for an entity at any point Single-threaded objects Improving The Situation
Halo 4 11+ million players 1.5 billion games 270 million hours
Orleans is a runtime & programming model for building distributed systems.
To: 0438 "Hi!" 0424 0488 0419 To: 0438 "Hi!" 0431 0438
IGrainWithIntegerKey or IGrainWithGuidKey or public interfaceISmsGrain:IGrainWithStringKey { TaskNewMessage(string message); Task<List<string>> GetMessages(); }
varbill = GrainFactory.GetGrain<ISmsGrain>("0438"); await bill.NewMessage("Hi!");
[StorageProvider(ProviderName= "MyStore")] public classSmsGrain : Grain<IMessageState>, ISmsGrain{ public asyncTaskNewMessage(stringmessage) { this.State.Messages.Add(message); awaitthis.State.WriteStateAsync(); } publicTask<List<string>> GetMessages() { returnTask.FromResult(this.State.Messages); } } public interface IMessageState : IGrainState { List<string> Messages { get; set; } }
Clustering • Location Transparency • Fault Tolerance • Error Propagation • Push Messaging • Persistence • Asyncvia async/await • Object Lifecycle/Cleanup Orleans Is Designed For The Cloud
A cloud native runtime New Activation New Activations Unavailable Silo New Silo
Push Messaging Clients subscribe to grains Grains message clients using simple method calls Note: All methods are void: unreliable messaging Use for progressive enhancement: supplement polling
public interfaceISmsObserver:IGrainObserver { void NewMessage(stringmessage); }
Case Study: FreeBay Mobile App Users can give away unwanted household items by taking a picture Users can see nearby items, claim them, then organise pickup
Suburb Name Items Observers Suburb Name Items Observers Location Items Auth Location Items Auth Images Location Owner Tags Images Location Owner Tags
Summary Designing for the Cloud is hard to get right Actor systems are resilient, scalable, & a great tool to have Orleans is engineered for the Cloud (Use it!)
Related Content Visit: http://orleans.codeplex.com Follow: @sbykov_work @richorama @CaitieM20 @reubenbond @johnazariah Watch: “Halo 4: High Demand with Low Latency and High Availability”