Stephane Lapointe & Alexandre Brisebois: Développer des microservices avec Service Fabric

67 %
33 %
Information about Stephane Lapointe & Alexandre Brisebois: Développer des microservices...

Published on March 16, 2016

Author: MSDEVMTL

Source: slideshare.net

1.  Introduced in 1973!  An actor is the fundamental unit of computation  Does some processing  Holds state  Communicates with other actors  Similar to objects in OOP Actor programming model

2. alexandre.brisebois@microsoft.com stephane@stephanelapointe.net

3.  Demo: Live Q&A app  Microwhat?  Service Fabric platform  Benefits  Programing models  Lifecycle management  Summary

4. Live Q&A application http://bit.ly/live-qnaDemo

5.    

6.   

7.  Build and operate services at scale  Agility - faster delivery of features & updates  Better resource utilization

8.  Simpler to design  Faster calls between components  Testing a single product  Tightly coupled within the tiered layers  Harder to perform fixes and upgrades

9.  Scalability + fast spinup  Encourage simpler business functionality encapsulation  Isolated components with independent lifecycle  Fit the lean startup approach – build, measure, learn, iterate  Increased number of separate entities  More complex deployments  Network latency between microservices  Easy to endup with a performance nightmare

10. Stateless microservice  Has either no state or it can be retrieved from an external store  There can be N instances  e.g. web frontends, protocol gateways, Azure Cloud Services etc. Stateful microservice  Maintain hard, authoritative state  N consistent copies achieved through replication and local persistence  e.g. database, documents, workflow, user profile, shopping cart etc.

11. A platform for reliable, hyperscale, microservice-based applications Azure Windows Server Linux Hosted Clouds Windows Server Linux Service Fabric Private Clouds Windows Server Linux High Availability Hyper-Scale Hybrid Operations High Density microservices Rolling Upgrades Stateful services Low Latency Fast startup & shutdown Container Orchestration & lifecycle management Replication & Failover Simple programming models Load balancing Self-healingData Partitioning Automated Rollback Health Monitoring Placement Constraints

12. Service discovery Reliability, Availability, Replication, Service Orchestration Application lifecycle Fault Inject, Test in production Federates a set of nodes to form a consistent scalable fabric Secure point-to-point communication Deployment, Upgrade and Monitoring microservices

13.  L+S (logic + state) that is independently versioned, deployed, and scaled  Has a unique name that can be resolved e.g. fabric:/myapplication/myservice  Interacts with other microservices over well defined interfaces and protocols like REST  Remains always logically consistent in the presence of failures  Hosted inside a “container” (code + config)  Can be written in any language and framework .NET, node.js, Java VMs, any EXE

14. A set of independent machines; physical or virtual

15. A set of machines that Service Fabric stitches together to form a cluster Clusters can scale to 1000s of machines Node Node Node Node Node Node

16. System Services Failover manager Cluster manager Naming Image store

17.  Each service is backed by replica set to make its internal state reliable  All replicas are logically consistent – meaning all replicas see the same linearized order of read and write operations to initial state  Read-Write quorums are supported and are dynamically adjusted  Replica set is dynamically reconfigured to account for replica arrivals and departures

18.  Massive scale  No difference between dev and production  Executables & frameworks can be .NET and/or OSS  Stateless or Stateful (micro)services  Simplify application design, stateful service instead of caches/queues

19.  Deploy applications in seconds  Write once, deploy almost anywhere  Higher density than VM  Multiple versions of the same application side by side  No downtime for breaking & nonbreaking upgrades

20.  Management via .NET APIs, PowerShell or REST  Upgrade and patch specific microservices  OOB health & diagnostic  Automatically adjust to scale up or scale down  Multiple version of the same application side by side, each independently upgradable  Self-healing resource balancer

21. Service Fabric Applications Azure Private Clouds Applications composed of microservices High Availability Hyper-Scale Hybrid Operations High Density Rolling Upgrades Stateful services Low Latency Fast startup & shutdown Container Orchestration & lifecycle management Replication & Failover Simple programming models Load balancing Self-healingData Partitioning Automated Rollback Health Monitoring Placement Constraints Service Fabric

22. Application Package Unit of • Lifetime • Versioning • Isolation LiveQnA.API Service type LiveQnA Extensions type LiveQnA Pkg Code Config LiveQnA Extensions Pkg Application Type

23.     Service Package B Service Package A Service Package B Service Package A Service Package B Service Package A Service Package B Service Package A

24.  Build reliable stateless and stateful objects using a virtual Actor programming model  Suitable for applications with multiple independent units of scale and compute  Automatic state management and turn based concurrency

25.  Actors have an lD that maps to an object  Service Fabric manages nodes and can transparently move actors amongst them (provides HA and scale)  Actor methods run via turn based concurrency

26. public interface IMyActor : IActor { Task<string> DoWorkAsync(); }

27. public class MyActor : Actor, IMyActor { public async Task<string> DoWorkAsync() { … return await Task.FromResult("result"); } }

28. var app = "fabric:/HelloWorld"; var proxy = ActorProxy.Create<IMyActor> (ActorId.NewId(), app); var result = proxy.DoWorkAsync().Result;

29. 1. 2. 3. OnActivateSync 4.

30. 1. 2. OnDeactivateSync 3.

31. Live Q&A application with Reliable Actors Demo

32.  Write services that are reliable, available, scalable and provide consistency  More control over data partitioning so you can determine data relationships and consistency requirements between chunks of state  Multithreaded  Use Reliable Collections to persist state  More likely to BYO transport (WCF, WebAPI, ..)

33. Collections • Single Threaded Concurrent Collections • Multi-Threaded Reliable Collections • Multi-Node • Replicated (HA) • Persistence Option • Asynchronous • Transactional Dictionary<TKey, TValue> ConcurrentDictionary<TKey, TValue> ReliableDictionary<TKey, TValue> Single Machine Multi-Machine Use our replicated datastructures or build your own

34. Data is replicated and durably stored on multiple replicas. Atomically update one or more collections using transactions. Reads are repeatable within the transaction. Enumerations are snapshot based. Supports LINQ. IReliableQueue<T>IReliableDictionary<K,V>

35. Reliable Actors APIs Reliable Services APIs Your problem space involves many small independent units of state and logic You need to maintain logic across multiple components You want to work with single-threaded objects while still being able to scale and maintain consistency You want to use reliable collections (like .NET Dictionary and Queue) to store and manage your state You want the framework to manage the concurrency and granularity of state You want to control the granularity and concurrency of your state You want the platform to manage communication for you You want to manage the communication and control the partitioning scheme for your service

36.    Node Node NodeNode Node Node Service Package B Service Package A

37. Application upgrade Demo

38.       

39.  Generates faults across the entire Service Fabric cluster  Compresses faults generally seen in months or years to a few hours  Combination of interleaved faults with the high fault rate finds corner cases that are otherwise missed  Leads to a significant improvement in the code quality of the service

40.   Restart a node  Restart a deployed code package  Remove a replica  Restart a replica  Move a primary replica (optional)  Move a secondary replica (optional)  Failover test

41.   Restart a deployed code package where the partition is hosted  Remove a primary/secondary replica or stateless instance  Restart a primary secondary replica (if a persisted service)  Move a primary replica  Move a secondary replica  Restart the partition

42. Welcome Chaos Demo

43. Stateless services A service that has state where the state is persisted to external storage, such as Azure databases or Azure storage Existing web (ASP.NET) and worker role applications Stateful services Reliability of state through replication and local persistence Reduces latency Reduces the complexity and number of components in traditional three tier architecture Existing apps written with other frameworks node.js, Java VMs, any EXE

44.  Are microservices for me?  Use Service Fabric to Reduce the complexities of building applications with the microservice approach  Start small, scale when needed, deprecate services, add new ones, evolve with customer usage, that’s the approach.

45.  Built micro-services using Reliable Actors and Reliable Services APIs  Achieve Data Reliability through Stateful Actors and Reliable Collections  Scale-out using partitioning

46. Download the Service Fabric developer SDK http://aka.ms/ServiceFabric Download the samples from GitHub http://aka.ms/ServiceFabricSamples Learn from the tutorials and videos http://aka.ms/ServiceFabricDocs Provide feedback http://aka.ms/ServiceFabricForum http://stackoverflow.com/questions/tagged/azure-service-fabric Twitter hastag #AzureServiceFabric

Add a comment

Related pages

Groupe Azure: Développer des microservices avec Service ...

... Développer des microservices avec Service Fabric ... Fabric Conférenciers: Alexandre Brisebois, ... avec Stephane via twitter (@s_lapointe) ...
Read more

Groupe Azure: Développer des microservices avec Service ...

... Service Fabric Conférenciers: Alexandre Brisebois, ... des microservices avec Service Fabric ... Développer des microservices avec Service ...
Read more

Guy Barrette | Architect, Developer, Azure MVP, Microsoft ...

A Practical Overview of Actors in Service Fabric Alexandre Brisebois, ... Guy Barrette Great! You completed ... Stephane Lapointe
Read more

Guy Barrette | DevTeach Montreal 2016 Azure/Cloud track ...

A Practical Overview of Actors in Service Fabric Alexandre Brisebois, ... microservices. Service Fabric is a ... offered by Service Fabric ...
Read more

Accueil

Le Complexe funéraire Châteauguay est une entreprise familiale au service des familles de ... avec tous nos services sous un ... Alexandre Nicole ...
Read more

Fabrice Ongenae | LinkedIn

View Fabrice Ongenae’s professional profile on LinkedIn. ... Information Technology and Services. Current: LINEBERTY, ... CV avec un design original;
Read more

Planiprêt | Choisissez la meilleure hypothèque

Nous négocions avec plusieurs prêteurs; Service rapide, pratique et personnalis ...
Read more

Recherchez les vidéos et les slideshare des sessions 2014 ...

Développement avec Windows Azure; Développer des applications ... Du streaming Live avec les jeux olympiques en passant par des services de VOD à ...
Read more

Collab365 2015 Sessions - Docs.com

... Collab365 2015 Sessions. ... Améliorer vos déploiements sur Azure Stephane Lapointe ... SharePoint et la continuité de services Fabrice ...
Read more