Presentation is loading. Please wait.

Presentation is loading. Please wait.

Walk in a distributed systems park with Orleans Yevhen Bobrov yevhen

Similar presentations


Presentation on theme: "Walk in a distributed systems park with Orleans Yevhen Bobrov yevhen"— Presentation transcript:

1 Walk in a distributed systems park with Orleans Yevhen Bobrov yevhen YouScan.io @

2 Orleans is … … runtime and programming model for building distributed systems based on actor model

3 Built by eXtreme Computing Group at Microsoft Research Has been used internally (during last few years) Open-sourced in 2015 (available on GitHub and Nuget)

4 Scalability Availability Reliablity built for *

5 Orleans powered by

6 Why do we need it?

7 Stateless Services Service

8 Stateless Services Service

9 Stateless Services Service

10 Stateless Services Service

11 Stateless Services Service

12 Stateless Services Service

13 Stateless Services Service

14 Data Shipping Paradigm

15 Service Data Shipping Paradigm

16 Service Data Shipping Paradigm

17 Service Data Shipping Paradigm

18 Service Data Shipping Paradigm

19 Service Data Shipping Paradigm

20 Service Data Shipping Paradigm

21 Service Data Shipping Paradigm

22 Service Data Shipping Paradigm

23 Service Data Shipping Paradigm

24 Service Data Shipping Paradigm

25 Service Data Shipping Paradigm

26 Service Data Shipping Paradigm

27 Service Data Shipping Paradigm

28 Stateless Services (a.k.a 3-tier) scales very badly

29 In a Cloud latency will kill you

30 Stateful Services

31 Service Function Shipping Paradigm

32 Service Function Shipping Paradigm

33 Service Function Shipping Paradigm

34 Service Function Shipping Paradigm

35 Service Function Shipping Paradigm

36 Service Function Shipping Paradigm

37 Service Function Shipping Paradigm

38 Service Function Shipping Paradigm

39 Service Function Shipping Paradigm

40 Service Function Shipping Paradigm

41 Service Function Shipping Paradigm

42 Stateful Services

43 shared state

44 Stateful Services shared state concurrency, locks, and all that jazz

45 Stateful Services shared state concurrency, locks, and all that jazz PAIN

46 Actor Model Single-threaded execution (no need to use locks) Data locality and consistency (due to encapsulation) Objects on steroids

47 Stateful Services Actors make it simple

48 How to distribute?

49 Akka / Erlang 10.0.0.1 10.0.0.2 var game = activate(“game”, “tcp://10.0.0.1”) game.invoke(“foo()”) var user = activate(“user”, “tcp://10.0.0.2”) user.invoke(“bar()”)

50 Routing Problems 10.0.0.1 10.0.0.2 10.0.0.5 10.0.0.8

51 Routing Problems 10.0.0.1 10.0.0.2 10.0.0.5 10.0.0.8

52 Routing Problems Cluster Membership

53 Routing Problems Cluster MembershipWorkload Distribution

54 Routing Problems Cluster MembershipWorkload Distribution Static

55 Routing Problems Cluster MembershipWorkload Distribution Static Dynamic

56 Routing Problems Cluster MembershipWorkload Distribution Static Dynamic Distributed Consensus

57 Routing Problems Cluster MembershipWorkload Distribution Static Dynamic Distributed Consensus Timeouts

58 Routing Problems Cluster MembershipWorkload Distribution Static Dynamic Distributed Consensus Timeouts Lifecycle

59 Routing Problems Cluster MembershipWorkload Distribution Static Dynamic Distributed Consensus Timeouts Lifecycle Co-location

60 Routing Problems Cluster MembershipWorkload Distribution Static Dynamic Distributed Consensus Timeouts Lifecycle PAIN Co-location

61 Orleans is … … runtime and programming model for building distributed systems based on actor model

62 Scalability Availability Reliablity How?

63 Virtual Actors

64 Location Transparency var game = activate(“game”, “tcp://10.0.0.1”) game.invoke(“foo()”) Akka / Erlang Orleans var game = activate(“game”) “tcp://10.0.0.1”) game.invoke(“foo()”)

65 Perpetual Existence var game = activate(“game”, “tcp://10.0.0.1”) game.invoke(“foo()”) Akka / Erlang Orleans var game = activate(“game”, “tcp://10.0.0.1”) game.invoke(“foo()”)

66 inversion of control Placement Lifecycle Runtime takes care of

67 courtesy of @johnazariah

68 Cooperative multitasking

69 Threads ~= Cores Core 1 Core 2 Core N Mechanical sympathy Scheduler (turns) Thread 1 Thread N

70 Non-blocking IO Promises (TPL, Task, Combinators) Multiplexed TCP Millions of actors with low OS overhead Automatic backpressure by design Synchronous, request-response messaging

71 Tour De Orleans

72 Grain (a.k.a. Actor) Silo (a.k.a. Node) Cluster (a.k.a. Cluster) Major Concepts

73 Define interface: public interface IInventoryItemGrain : IGrain { Task Increment(int qty); Task Decrement(int qty); Task Total(); }

74 Define implementation: class InventoryItemGrain : Grain, IInventoryItemGrain { int total; CloudBlockBlob blob; public async Task Increment(int qty) { total++; return blob.UploadAsync(qty.ToString()); } public Task Decrement(int qty) { total--; return blob.UploadAsync(qty.ToString()); } public Task Total() => Task.FromResult(total); }

75 Invoke: var item = GrainFactory.GetGrain ("iPhone"); await item.Increment(100); await item.Decrement(100); Console.WriteLine(await item.Total());

76 More Orleans

77 Workers [auto-scale] Reentrancy Placement Hints [local, even distribution] Automatic GC Timers/Reminders Streams [TCP, azure queues, pub-sub]

78 When to use?

79 Scaling 3-tier architecture (stateless stateful)

80 IoT GPS Tracker (RFID, inventory, cars) Counters (running total) Sensor data

81 Data stream processing Fraud detection Aggregation

82 Ultra-scalable & reliable web crawling

83 END


Download ppt "Walk in a distributed systems park with Orleans Yevhen Bobrov yevhen"

Similar presentations


Ads by Google