Post on 28-Jan-2018
.NET Conf
Learn. Imagine. Build.
.NET Conf
The Microservices world in. NET Core and. NET Framework
Massimo Bonanni
massimo.bonanni@microsoft.com
@massimobonanni
.NET Conf
.NET Conf
Microservices Architecture
.NET Conf
.NET Conf
.NET Conf
Traditional application approach Microservices application approach
• A microservice application
segregates functionality into
separate smaller services.
• Scales out by deploying each
service independently with
multiple instances across
servers/VMs
• A traditional application has
most of its functionality within a
few processes that are
componentized with layers and
libraries.
• Scales by cloning the app on
multiple servers/VMs
App 1 App 2App 1
.NET Conf
Stateless services
with
separate stores
• Single monolithic database
• Tiers of specific technologies
Data in Traditional approach Data in Microservices approach
• Graph of interconnected microservices
• State typically scoped to the microservice
• Remote Storage for cold data
Stateful
services
Web presentation
services
Stateless
services
SQL DB
or
No-SQL
Mobile
apps
Web Tier
Services Tier
Data Tier
Monolithic Databases are shared across services.
Each microservice owns its model/data!
SQL
[…]
Database servers are usually the bottleneck
Cache Tier
Cache doesn’t help much for massive data
ingress (Events, IoT, etc.)
.NET Conf
Is a unit of deploy
that can be
independently
versioned, deployed
and scaled
Has a unique name
that can be resolved
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
Developed by a small
engineering team
.NET Conf
Microservices, Docker & .NET
.NET Conf
Official Docker Imageshttps://hub.docker.com
or
Cluster of
Nodes/Hosts
VM
App 1 App 2 My Docker Images
.NET Conf
https://docs.docker.com/swarm/overview/
.NET Conf
https://mesosphere.com/product/
.NET Conf
https://kubernetes.io/
.NET Conf
.NET Conf
Service Fabric
.NET Conf
Azure Other CloudsOn-Premise
Data centersDev Box
Service Fabric on
Linux in Azure
Preview
Service Fabric for
Linux
Coming 2017
Service Fabric
Windows SDK
Available
Service Fabric on
Windows in Azure
Available
Service Fabric in
Azure Stack GA
Coming 2017
Service Fabric for
Windows Server
Available
Service Fabric on
Linux in Azure
Available
.NET Conf
.NET Conf
.NET Conf
.NET Conf
.NET Conf
.NET Conf
.NET Conf
.NET Conf
.NET Conf
60bn events/day
.NET Conf
.NET Conf
Orchestrator Description Good for Common
workloads
Azure Service Fabric is a distributed
systems platform that makes it easy
to package, deploy, and manage
scalable and reliable microservices
a) Stateful svc & Actors
b) Microservices based
on plain processes
c) Microservices based
on containers
Docker Swarm is a clustering and
scheduling tool for Docker containers.
With Swarm, IT administrators and
developers can establish and manage
a cluster of Docker nodes as a single
virtual system
Microservices based on
containers
Kubernetes is an open-source platform
for automating deployment, scaling,
and operations of application
containers across clusters of hosts
Microservices based on
containers
As a datacenter operating system,
DC/OS is itself a distributed system, a
cluster manager and a container
platform
Microservices based on
containers (Including other
Linux containers, not just
Docker)
More mature:
Less mature:
More mature:
Less mature:
More mature:
Less mature:
Azure Product
Azure Service Fabric
Azure Container Service Docker Swarm
Service FabricProduction-ready &
Microsoft ecosystem
Mesosphere DC/OS
More mature:
Less mature:
Production-ready &
Linux ecosystem
Easy to get started
Dev/Test and Production
Kubernetes
Production-ready &
Linux ecosystem
.NET Conf
.NET Conf
aka.ms/MicroservicesEbook aka.ms/MicroservicesArchitecture
Additional subjects covered in the eBook
Domain Driven Design Patterns• Domain Models (Aggregates, Entity, VO, etc.)• Simplified CQRS
• Dapper MicroORM for queries• Commands and Mediator patter
• Domain Events (within the same microservice)
Microservices• Integration Events (across microservices)• Multi-container docker-compose.yml• Swagger w/ Swashbuckle• Security (Authentication/Authorization) with
tokens from IdentityServer4 wrapping ASP.NET Identity
.NET Conf