40
Sponsored & Brought to you by Service Fabric – building tomorrow’s applications today Mick Badran http://www.twitter.com/mickba https://au.linkedin.com/in/mickbadran

Service Fabric – building tomorrows applications today

Embed Size (px)

Citation preview

Page 1: Service Fabric – building tomorrows applications today

Sponsored & Brought to you by

Service Fabric – building tomorrow’s applications todayMick Badran

http://www.twitter.com/mickba

https://au.linkedin.com/in/mickbadran

Page 2: Service Fabric – building tomorrows applications today

PEOPLE TECHNOLOGY INTEGRATION

Service Fabric – Building Tomorrows Applications TodayMick BadranIntegration Monday 2015-11-23

PRESENTATION

Page 3: Service Fabric – building tomorrows applications today

CTO @ MOQdigitalAzure MVP, Insider & Advisor@mickba,[email protected] mo-vember

Who Am I

Page 4: Service Fabric – building tomorrows applications today

Solutions - How to Connect?

Page 5: Service Fabric – building tomorrows applications today

• What is Service Fabric• Demo – Stateful Actor counters• Service Fabric Applications• Demo – Stateful with Events• Service Fabric Clusters• Demo – Stateful Services – causing chaos• Upgrading Apps with no downtime• Demo – No Downtime Upgrade• Wrap Up…

Agenda

Page 6: Service Fabric – building tomorrows applications today

What is Service Fabric?

Page 7: Service Fabric – building tomorrows applications today

Application development in the age of the CloudFeatures

Scalability

Manage ServicesDeliver Features FasterCreate Business Value

AvailabilityLatencyLifecycleData IntegrityPortability

Page 8: Service Fabric – building tomorrows applications today

MICROSOFT AZURE SERVICE FABRICA PLATFORM FOR RELIABLE, HYPERSCALE, MICROSERVICE-BASED APPLICATIONS

Microservices

Application Programming Models

Azure

WindowsServer Linux

Hosted Clouds

WindowsServer Linux

Service Fabric

Private Clouds

WindowsServer Linux

High Availability

Hyper-Scale

Hybrid Operations

High Density

Rolling Upgrades Stateful

services

Low Latency Fast startup & shutdown

Container Orchestration & lifecycle management Replication &

FailoverSimple

programming models

Load balancing

Self-healingData Partitioning

Automated Rollback

Health Monitoring

Placement Constraints

Page 9: Service Fabric – building tomorrows applications today

BATTLE-HARDENED FOR OVER 5 YEARS

Azure Core Infrastructure

thousands of machines

Power BI

Intune

800k devices

Azure SQL Database

1.4 million databases

Bing Cortana

500m evals/sec

Azure Document

DB

billions transactions/wee

k

Skype for Business

Hybrid Ops

Event Hubs

20bn events/day

Page 10: Service Fabric – building tomorrows applications today

What is a microservice?Is (logic + state) that is independently versioned, deployed, and scaled

Has a unique name that can be resolvede.g. fabric:/myapplication/myservice

Call other Microservices

Remains always logically consistent in the presence of failures

Hosted inside a “container” (code + config)

Page 11: Service Fabric – building tomorrows applications today

Stateless applications A service that has state where the state is persisted to external storage, such as Azure

databases or Azure storage e.g. Existing web (ASP.NET) and worker role applications

Stateful applications 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

What can you build with Service Fabric

Page 12: Service Fabric – building tomorrows applications today

Installing Service FabricProvision through the Azure PortalProvision via an Install – Win10/Win2012/R2

http://aka.ms/ServiceFabric

Page 13: Service Fabric – building tomorrows applications today

Service Fabric Applications

Azure Private Clouds

Applications composed of microservices

High Availability

Hyper-Scale

Hybrid OperationsHigh

DensityRolling Upgrades Stateful

services

Low Latency Fast startup & shutdown

Container Orchestration & lifecycle management Replication &

FailoverSimple

programming models

Load balancing

Self-healingData Partitioning

Automated Rollback

Health Monitoring

Placement Constraints

Service Fabric

Reliable Actors API Reliable Services API

Page 14: Service Fabric – building tomorrows applications today

Reliable Actor API• Build reliable stateless and stateful objects with a virtual Actor

Programming Model

• Suitable for applications with multiple independent units of state and compute

• Automatic state management and turn based concurrency (single threaded execution)

Page 15: Service Fabric – building tomorrows applications today

Demo: Stateful Counters

Page 16: Service Fabric – building tomorrows applications today

Application Package

Unit of • Lifetime• Versioning• Isolation

Counter Service type

Counter WebApp type

Defining applications and services

CounterService

Pkg

Code Config

CounterWebApp

Pkg

Application Type

Page 17: Service Fabric – building tomorrows applications today

Instantiating an application

• ServiceType is “like” a .NET CLR type (class CounterServiceType)• ApplicationType is “like” a typed Container (CounterAppType : ServiceContainer<TServiceType> where TServiceType is

CounterServiceType, ServiceType2• ApplicationInstance is an instance of the ApplicationType and has an unique name “fabric:/CounterApplication”• Each service instance has a unique name in the “namespace” of the application

“fabric:/CounterApplication/CounterService”

Service Package

B

Service Package

A

app1

Service Package

B

Service Package

A

app4

Service Package

B

Service Package

A

app2

Service Package

B

Service Package

A

app3

Page 18: Service Fabric – building tomorrows applications today

Reliable Collections• Reliable collections make it easy to build stateful services.

• Evolution of the .NET collections for the cloud

Collections• Single machine• Single threaded

Concurrent Collections• Single machine• Multi threaded

Reliable Collections• Multi machine• Replicated (HA)• Persistence (durable)• Asynchronous• Transactional

Page 19: Service Fabric – building tomorrows applications today

Reliable Services API• Build stateless services using existing technologies such as ASP.NET

• Build stateful services using reliable collections

• Manage the concurrency and granularity of state changes using transactions

• Communicate with services using the technology of your choice (e.g WebAPI, WCF)

Page 20: Service Fabric – building tomorrows applications today

Cloud Services

Azure Tables/NoSQL

Reliable Azure Queue

Service Fabric(Stateful)

Typical Service Fabric ServiceCloud Service vs Stateful Service Fabric

Page 21: Service Fabric – building tomorrows applications today

Demo: Reliable Actor API with Events

Page 22: Service Fabric – building tomorrows applications today

Service Fabric Clusters

Page 23: Service Fabric – building tomorrows applications today

A set of machines that Service Fabric stitches together to form a cluster

Clusters can scale to1000s of machines

CLUSTER: A FEDERATION OF MACHINES

Node

Node

Node

Node

Node

Node

Page 24: Service Fabric – building tomorrows applications today

SERVICE FABRIC SUBSYSTEMS

Communicationsubsystem

Reliabilitysubsystem

Activationsubsystem

TestabilitysubsystemFederation

Transport

Application Programming Models

Microservices

Managementsubsystem

Page 25: Service Fabric – building tomorrows applications today

Nodes failed

Machine failure detection

Time = t1

83 76 50 4664 New Node arrived61

Time = t2

8361

50 46Failures Detected

cluster reconfigured

83 76 6450 46

Time = t0

Page 26: Service Fabric – building tomorrows applications today

Queues Storage

3-TIER SERVICE PATTERN

Front End(StatelessWeb)

StatelessMiddle-tierCompute

Cache

• Scale with partitioned storage

• Increase reliability with queues

• Reduce read latency with caches

• Manage your own transactions for state consistency

• Many moving parts each managed differently

Load Balancer

Page 27: Service Fabric – building tomorrows applications today

StatefulMiddle-tierCompute

STATEFUL SERVICES: SIMPLIFY DESIGN, REDUCE LATENCY

Front End(StatelessWeb)

data stores used for analytics and disaster recovery

• Application state lives in the compute tier

• Low Latency reads and writes

• Partitions are first class for scale-out

• Built in transactions

• Fewer moving parts

Load Balancer

Page 28: Service Fabric – building tomorrows applications today

Stateful microservices are reliable and consistent

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

Page 29: Service Fabric – building tomorrows applications today

Stateful microserviceApplication Package

PSSreplication

replication

PSS

Page 30: Service Fabric – building tomorrows applications today

ReplicationReads are completed at the primaryWrites are replicated to the write quorum of secondaries

P

S

S

S

SWriteWrite

WriteWrite

AckAck AckAck

ReadValue WriteAck

Page 31: Service Fabric – building tomorrows applications today

ReconfigurationTypes of reconfiguration• Primary failover• Removing a failed secondary • Adding recovered replica• Building a new secondary

Replica States• None• Idle Secondary • Active Secondary• Primary

P

S

S

S

S

S

Must be safe in the presence of cascading failures

B PXFailed

XFailed

Page 32: Service Fabric – building tomorrows applications today

Demo: Stateful MicroserviceCausing Chaos…

Page 33: Service Fabric – building tomorrows applications today

Upgrading Applications

Page 34: Service Fabric – building tomorrows applications today

APPLICATION: LOGICAL GROUPING OF MICROSERVICES

Application Container Container

Container

Container

Page 35: Service Fabric – building tomorrows applications today

Upgrading Services with zero downtimeApplication Package

FD0/UD0

FD0/UD1

FD1/UD6

FD1/UD5

FD2/UD4

FD2/UD3

Page 36: Service Fabric – building tomorrows applications today

Demo: No Downtime Upgrade

Page 37: Service Fabric – building tomorrows applications today

Wrapping up… Service Fabric provides a modern consistent framework

for your high demand Solutions. Service Fabric provides higher fidelity management of

Solutions… Logging, Fault tolerance, Upgrades, Restarts, Low

Latency… SCALE!!!!!

Page 38: Service Fabric – building tomorrows applications today

Application development in the age of the CloudFeatures

Scalability

Manage ServicesDeliver Features FasterCreate Business Value

AvailabilityLatencyLifecycleData IntegrityPortability

Page 39: Service Fabric – building tomorrows applications today

Q&AMick Badran@[email protected]

Page 40: Service Fabric – building tomorrows applications today

PEOPLE TECHNOLOGY INTEGRATION

Thank you