service fabric – building tomorrows applications today
TRANSCRIPT
Sponsored & Brought to you by
Service Fabric – building tomorrow’s applications todayMick Badran
http://www.twitter.com/mickba
https://au.linkedin.com/in/mickbadran
PEOPLE TECHNOLOGY INTEGRATION
Service Fabric – Building Tomorrows Applications TodayMick BadranIntegration Monday 2015-11-23
PRESENTATION
CTO @ MOQdigitalAzure MVP, Insider & Advisor@mickba,[email protected] mo-vember
Who Am I
Solutions - How to Connect?
• 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
What is Service Fabric?
Application development in the age of the CloudFeatures
Scalability
Manage ServicesDeliver Features FasterCreate Business Value
AvailabilityLatencyLifecycleData IntegrityPortability
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
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
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)
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
Installing Service FabricProvision through the Azure PortalProvision via an Install – Win10/Win2012/R2
http://aka.ms/ServiceFabric
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
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)
Demo: Stateful Counters
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
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
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
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)
Cloud Services
Azure Tables/NoSQL
Reliable Azure Queue
Service Fabric(Stateful)
Typical Service Fabric ServiceCloud Service vs Stateful Service Fabric
Demo: Reliable Actor API with Events
Service Fabric Clusters
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
SERVICE FABRIC SUBSYSTEMS
Communicationsubsystem
Reliabilitysubsystem
Activationsubsystem
TestabilitysubsystemFederation
Transport
Application Programming Models
Microservices
Managementsubsystem
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
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
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
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
Stateful microserviceApplication Package
PSSreplication
replication
PSS
ReplicationReads are completed at the primaryWrites are replicated to the write quorum of secondaries
P
S
S
S
SWriteWrite
WriteWrite
AckAck AckAck
ReadValue WriteAck
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
Demo: Stateful MicroserviceCausing Chaos…
Upgrading Applications
APPLICATION: LOGICAL GROUPING OF MICROSERVICES
Application Container Container
Container
Container
Upgrading Services with zero downtimeApplication Package
FD0/UD0
FD0/UD1
FD1/UD6
FD1/UD5
FD2/UD4
FD2/UD3
Demo: No Downtime Upgrade
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!!!!!
Application development in the age of the CloudFeatures
Scalability
Manage ServicesDeliver Features FasterCreate Business Value
AvailabilityLatencyLifecycleData IntegrityPortability
Q&AMick Badran@[email protected]
PEOPLE TECHNOLOGY INTEGRATION
Thank you