massively scaleable .net web services with project orleans
Post on 16-Apr-2017
94 Views
Preview:
TRANSCRIPT
Massively Scalable .NET Web Services w/ Project OrleansDECEMBER 5TH 2016 – NEWMAN SCOTT HUNTERSCOTT@DRIFTLOGIC.NETSCOTTHUNTER@EA.COM
Who is this guy?
Agenda• Introducing Orleans• Basic Actor Concepts• Orleans Terminology• Orleans in Action• Use Cases and Gotchas
What is Orleans?• .NET Framework used to create
Scalable, Distributed, .NET Applications• Focused on low response
latency and high concurrency• Usable in any .NET application
(but frequently used with WebAPI Applications)• Based on a system of Virtual
Actors
What are Actors?
What are Actors?
A framework for concurrency based on Message Passing between objects that eliminates (or greatly reduces) the developer overhead involved in multithreaded development.
Thread One Thread Two Thread Three
Memory
Memory
Memory
Memory
Thread A Thread B
Orleans Terminology
What are actors?• Actors have ‘message boxes’ where actions to be performed
by the actor are stored, and processed in the order they arrive.• Actor message execution is typically single threaded*• Because Actors only execute messages stored in their inbox
and can only send messages to other Actors via their inboxes, issues with concurrency are minimized*
What are VIRTUAL actors?
• Must be instantiated before messages can be received.
Concrete Actors• Can be messaged
regardless if they have been created.
Virtual Actors
Orleans Terminology
• Each Orleans ‘Actor’ is a ‘Grain’. A grain SHOULD correspond to a discrete unit.
Orleans Terminology
• Each ‘Grain’ receives one ‘Turn’ when executing awaiting messages, and may send messages to other ‘Grain’s
Orleans Terminology
• Each ‘Grain’ must be created in a ‘Silo’. A silo is a process containing the activated ‘Grains’, managers for activation and persistence, messaging, grain directory, and scheduler.
Messaging / Serialization
Persistence / Activation Manager
Actor Directory
Scheduler
Orleans Terminology
• A cluster consists of multiple silos. Each silo maintains a directory of Grains activated within it and will pass messages to grains created in other silos, if active.
Orleans Terminology
• Each Silo has a client access port, so requests to any grain can be addressed to any silo.
Orleans Terminology
IIS
Orleans in Action
Orleans in Action• Three core components• Interface• Implementation• Access
Orleans in Action
Orleans in Action• Possible Grain Keys (As Defined by the Interface)• Guid• Long• String• ‘Compound Primary’• Hash of a GUID and a Long
Orleans in Action• Grain Keys control the activation of each grain
(Remember that each grain has STATE and is backed by a datastore)• Grain Activation (and destruction) has an overhead, but
can also be choke points.• Keys for grains should be designed around the use case.
Orleans in ActionUse Case• Working with User
Information• Performing Requests on
Multiple Users (in the same request)• Working with Group
Session
Example Grain Key• User ID (LONG or STRING)• CONST LONG
• GUID (tracked within the requesting client OR a grain)
Orleans in Action
Orleans in Action
Use Cases and Gotchas
Use Cases and Gotchas[StatelessWorker]• By default, Orleans activates only ONE copy of a grain across
all silos.• If a Grain is marked as StatelessWorker, then multiple copies
of the same grain will be created, per silo, as needed.• If existing workers are busy, additional instances are created
within the silos automatically.
Use Cases and GotchasScaling Orleans• New Silos can be added at any time.• Created grains do not redistribute, once a grain is created, it is
tied to the created silo• To redistribute at high load, the cluster needs to be restarted,
so that grains are reactivated.
Use Cases and GotchasOrleans + Sharding• For maximum impact, data storage needs to be SHARDED.• If all grains perform data access on the same table (or document),
then Orleans makes it easier to overwhelm any particular table.• Grains make it easier to fully utilize sharded data stores for
maximum throughput.
More InfoOrleans Homepagehttps://dotnet.github.io/orleans/
Halo 4 Web Services in Orleanshttps://www.youtube.com/watch?v=rEa2nQrpEhc
Orleans MSR Home Pagehttps://www.microsoft.com/en-us/research/project/orleans-virtual-actors/
Azure Reliable Actorshttps://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-actors-get-started
Java Orbithttps://github.com/orbit/orbit
Newman Scott Hunterscott@driftlogic.netscotthunter@ea.com
top related