Download - Anatomie von Microservice Landschaften
Anatomie von
Microservice Landschaften
Michael PlödPrincipal Consultant bei innoQ
@bitboss
Die klassische old school
Software-Architektur
HugeSOAPEndpoints
HugeBusinessServices
HugeDAOs
Business Model
Client
DTO
View Model
Central RDBMS
ER-Model
Network
Network
HugeSOAPEndpoints
HugeBusinessServices
HugeDAOs
Business Model
Client
DTO
View Model
Central RDBMS
ER-Model
Network
Network
MONOLITH
One huge system to serve them all
„In short, the microservice architectural style is an approach to developing a single application as a
suite of small services, each running in its own process and communicating
with lightweight mechanisms, often an HTTP resource API.“
Martin Fowler:
http://martinfowler.com/articles/microservices.html
1 Klein
2 Autonom
3 Kollaborativ
Accounting
Customer
Customer Service
Monetary Transactions
Crediting
Billing
Trading
Microservices sind kein „Freibier“
!
Die Herausforderung ist weniger die Implementierung eines Microservices selbst, sondern das Umfeld in dem man selbige betreibt.
Herausforderungen
Business Design Deployment
Collabora-tionMonitoring
Interface Design
Resilience
1 Business Design
Leite Microservices vomBounded Context ab
Modularisierung ist ein 1. Schritt
Hinterfrage N-Tier Architekturen
2 Interface Design
Orchestrierung vs Choreographie
oder
Synchron vs Asynchron
AuthorService
EMail Service
Roles Service
OutBound Service
Print Service
Post Service
Synchrone Orchestrierung
AuthorService
EMail Service
Roles Service
OutBound Service
Asynchrone Choreographie
Author Created Event
!Asynchrone Microservices benötigen eine Message Broker Infrastruktur
Lasst uns den ohnehin lizensierten ESB der
gescheiterten SOA Initiative verwenden
NEIN
!Präferiere „dumme Rohre“ mit klugen Endpoints als Message Broker Architektur
!Wie müssen Microservices deployed werden?
Berücksichtige dabei Loose Kopplung!
3 Deployment
Die typische Evolution einer Microservice Landschaft…
µService
µService
t
µService
µService
µService
µService
µService
µService
t
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
t
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
t
HELP!
t
µService µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
t
µService µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
µService
!Vor der Einführung von Microservices MUSS man einen hohen Automatisierungs-Grad erreicht haben
> Continuous Delivery
> Automatisierte Bereitstellung von Infrastruktur
> Automatisiertes Testing
4 Collaboration
Sind Microservices das Wiederauferstehen der Spaghetti Integration?
AuthorService
EMail Service
Roles Service
OutBound Service
Print Service
Post Service
Hard wiring von Service-Endpoints funktioniert nicht in einer hoch
automatisierten Cloud-Landschaft
AuthorService
EMail Service
Roles Service
OutBound Service
Print Service
Post Service
Will man alle Microservices auf einer Maschine deployen?
AuthorService
EMail Service
Roles Service
OutBound Service
Print Service
Post Service
oder zieht man einen Host pro Microservice vor?
AuthorService
EMail Service
Roles Service
OutBound Service
Print Service
Post Service
Docker?
AuthorService
EMail Service
Roles Service
OutBound Service
Print Service
Post Service
Rollout einer neuen Version
AuthorService
EMail Service 1.0
Rollout einer neuen Version
AuthorService
EMail Service 1.0
EMail Service1.1
Rollout einer neuen Version
AuthorService
EMail Service 1.0
EMail Service1.1
Wie bekommt der AutorService nun den 1.1 Endpoint?
Rollout einer neuen Version
AuthorService
EMail Service 1.0
EMail Service1.1
Wie bekommt der AutorService nun den 1.1 Endpoint?
Rollout einer neuen Version
AuthorService
EMail Service 1.0
EMail Service1.1
Wie bekommt der AutorService nun den 1.1 Endpoint?
Rollout einer neuen Version
AuthorService
EMail Service1.1
Wie bekommt der AutorService nun den 1.1 Endpoint?
!Service Registries wie zB Netflix Eureka, Zookeeper, Kubernetes or Etcd helfen!
5 Resilience
Die Fähigkeit eines Systems mit unerwarteten Ereignissen umzugehen • ohne dass es der User merkt • mit graceful service degradation
TAKEN FROM UWE FRIEDRICHSEN
> Microservice Systeme sind komplex und zu einem hohen Grad verteilt
> Fehler passieren und sind nicht vorhersehbar
> Roll Forward ist wichtiger wie Roll Back
AuthorService
EMail Service Roles Service
THREAD POOL
AuthorService
EMail Service Roles Service
THREAD POOL
AuthorService
EMail Service Roles Service
THREAD POOL
Wird langsamer und langsamer
AuthorService
EMail Service Roles Service
THREAD POOL
Wird langsamer und langsamer
Thread Pool ist voll
AuthorService
EMail Service Roles Service
THREAD POOL
Wird langsamer und langsamer
Thread Pool ist voll
Keine Requests zu anderen
Downstream Systemensind mehr möglich
AuthorService
EMail Service Roles Service
THREAD POOL
Wird langsamer und langsamer
Thread Pool ist voll
Eingehende Requests hängen
!Führe eine Bulkhead und Circuit Breaker Komponente ein
AuthorService
EMail Service Roles Service
THREAD POOL THREAD POOLBulkheads
Circuit Breakers
Source: https://github.com/Netflix/Hystrix/wiki/How-it-Works https://github.com/Netflix/Hystrix/wiki/How-It-Works
Wie funktioniert Hystrix?
6 Monitoring
Es ist wichtig, frühzeitig eine ganzheitliche Sicht auf das System zu bekommen
> Es ist nicht ausreichend, jede Node einzeln zu monitoren
>Es muss gewährleistet sein, dass alle Logs / Statistiken von alles Nodes konsolidiert werden können
> Requests müssen an einer Stelle über das ganze System hinweg analysiert werden können
Request Correlation IDs
AuthorService
EMail Service
Roles Service
OutBound Service
Print Service
Post Service
CID: 1502
CID: 1502
CID: 1502
CID: 1502
CID: 1502
CID: 1502
Herausforderung angenommen?
Business Design Deployment
Collabora-tionMonitoring
Interface Design
Resilience
Fragen?Michael Plöd
@bitbosshttp://slideshare.net/[email protected]