From SOA to MSA– Creating Adaptive and Innovation Sup portive Architecture and Organization -by William
Topics • Principles of Microservices Architecture • Patterns and Best Practices of Microservices • Microservices Organization • Application of Microserivces Architecture
Problem Domain • System & Organization Decoupling • Legacy System Upgrading • Use suitable platform and technology to solve different problems – Golden Hammer Syndrome - Always Win/.Net • Foster business innovation, dealing with outside compe tition – Innovation as a platform • Creating extensible, agile and adaptive architecture and organization.
SOLID Review - Single Responsibility Principle
SOLID Review – Liskov Substitution Principle
SOLID Review – Dependency Inversion Princi ple
GRASP – General Responsibility Assignment S oftware Principles • High Cohesion, Low Coupling – How to keep objects appropriately focused, manageable and understandable? – How to minimize dependencies, change impact and maximize reuse? • Information Expert – What’s the general principle to assign responsibilities to object? • Controller – Who should receive events and coordinate the overall system operation? • Polymorphism – How to make components pluggable? • Pure Fabrication – How to assign responsibilities to class representing concept not existing in problem domain？ • Indirection – How to decouple between two(or more) objects? • Protected Variation – How to design object or system that its internal instability or variation will not have bad impact to ot her elements of the object or system？
Microservices Architecture • A system architectural style, it is SOLID and GR ASP principles applied at architectural level, in cluding some patterns and best practices. • SOA is too coarse-grained, Microservices is fin e-grained and practical SOA. • Microservices architecture needs technical infr astructure and organization support.
Monolithic -> SOA -> MicorServices
Legacy System Decouple & Upgrade
Coupled SOA Coupling Coupling Mi M ddle e Edge Svc Tier e Sv S c v Edge Sv
Key Elements of Microservices Architecture • Stateless Service – Support scale out • Low Friction Deployment – Fast and flexible service deployment and upgrade. • Automated Management & Monitoring – Push common concerns to technical infrastructure and fra mework, service developers only need to care for business logic. • Automated Service Discovery & Routing – Decouple services, flexible upgrade and replacement.
Version Control of Microservices Leave multiple old microservice versions running Fast introduction vs. slow retirement asymmetry Brute force upgrade Backward compatible Multiple versions coexistence
Invocation Pattern of Microservices
Single Dependency Delay Causing Blocking of User Request
All Request Threads Can be Blocked at Peak H our(aka. Cascading Failure)
Cross Data Center Active-Active Fallback Invocation Fallback Invocation
Conway’s Law • “…organization which design systems … are constr ained to produce designs which are copies of the communication structure of those organizations” – Melvin Conway, 1968 • “If you ask nine people to write a compiler, you ge t a nine pass compiler” • “Those system then constrain the options for orga nizational change” – Dan North
Team Organized by Technical Layer
Traditional Organizational Structure GAP & WALL
Microservices Organization Organized around Business Capabilities Products not Projects Ful stack skil team
The Cost of Microservices • System Complexity – Too much microservices, developer can’t build con text and see the big picture, – Need better architectural integration patterns. • Performance – Performance penalty because of cross-process inv ocation, 20 - 200ms per hop average. – Tune time consuming invocation, leverage microse rvices invocation pattern.
Microservices View Architecture - A Case In Practice Control er Common Concerns : routing, auth, rate limiting, monitoring, Service logging Routing Table Model
Take Away • Independently scalable, deployable, changeable, replac eable • Evolutionary architecture and emergent design are appr oaches that maximize flex • Programmable microservices platform fostering innovati on • Standardize in the gaps between services – flexible abou t what happens inside the boxes • Separation of Concerns & Bounded Context • Another layer of indirection for decoupling