Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Department for Work & Pensions 1
From Monolith to Microservices
by Andrew Rea
Department for Work & Pensions 2
From Monolith to Microservices by Andrew Rea
Know your Monolith
API CONUSMERS
APPLICATION...
Department for Work & Pensions 3
From Monolith to Microservices by Andrew Rea
That’s another fine mess you’ve gotten me int...
Department for Work & Pensions 4
From Monolith to Microservices by Andrew Rea
That’s another fine mess you’ve gotten me int...
Department for Work & Pensions 5
From Monolith to Microservices by Andrew Rea
Microservices?
APPLICATION
DATABASE
SERVICE
...
Department for Work & Pensions 6
From Monolith to Microservices by Andrew Rea
APPLICATION
DATABASE
SERVICE
SERVICESERVICE
...
Department for Work & Pensions 7
From Monolith to Microservices by Andrew Rea
What are Microservices?
SMALL
HOW SMALL?
INT...
Department for Work & Pensions 8
From Monolith to Microservices by Andrew Rea
How do you get there?
GOOD DESIGN PRACTICES
...
Department for Work & Pensions 9
From Monolith to Microservices by Andrew Rea
SEPARATE PROCESS PER SERVICE
APPLICATIONS
DA...
Department for Work & Pensions 10
From Monolith to Microservices by Andrew Rea
INDEPENDENT - HOW?
DEVELOP INDEPENDENTLY
DE...
Department for Work & Pensions 11
From Monolith to Microservices by Andrew Rea
INTEROPERABLE - HOW?
COMMON TRANSPORT PROTO...
Department for Work & Pensions 12
From Monolith to Microservices by Andrew Rea
SEPARATE SERVICES BY BUSINESS CAPABILITY
SE...
Department for Work & Pensions 13
From Monolith to Microservices by Andrew Rea
HOW DO THEY SCALE?
SERVICE
DOMAIN 1
DOMAIN ...
Department for Work & Pensions 14
From Monolith to Microservices by Andrew Rea
DOES THIS HELP SECURITY?
WE CAN DEPLOY SEPA...
Department for Work & Pensions 15
From Monolith to Microservices by Andrew Rea
SEPARATE BUILD PIPELINES
SERVICE
1
SERVICE
...
Department for Work & Pensions 16
From Monolith to Microservices by Andrew Rea
SEPARATE SOURCE CONTROL
SERVICE
SERVICE
SER...
Department for Work & Pensions 17
From Monolith to Microservices by Andrew Rea
SEPARATE SOURCE CONTROL
GIVE EACH SERVICE I...
Department for Work & Pensions 18
From Monolith to Microservices by Andrew Rea
A REASON TO RESTRUCTURE YOUR TEAMS
SERVICE
...
Department for Work & Pensions 19
From Monolith to Microservices by Andrew Rea
HOW SMALL (OR LARGE)?
2000 LINES OF CODE?
T...
Department for Work & Pensions 20
From Monolith to Microservices by Andrew Rea
HOW DO THEY COMMUNICATE
CALL
CALL
CALL
SERV...
Department for Work & Pensions 21
From Monolith to Microservices by Andrew Rea
WHAT ABOUT MONITORING?
CALL
CALL
CALL
META ...
Department for Work & Pensions 22
From Monolith to Microservices by Andrew Rea
HOW DO CONSUMING APPS GET STABILITY?
SERVIC...
Department for Work & Pensions 23
From Monolith to Microservices by Andrew Rea
HOW TO VERSION THE SERVICES?
<MAJOR>.<MINOR...
Department for Work & Pensions 24
From Monolith to Microservices by Andrew Rea
RESILIENT?
DOWNSTREAM

SYSTEMS
CIRCUIT BREA...
Department for Work & Pensions 25
From Monolith to Microservices by Andrew Rea
RESILIENT?
DOWNSTREAM

SYSTEM
DOWNSTREAM

S...
Department for Work & Pensions 26
From Monolith to Microservices by Andrew Rea
RESILIENT?
SERVICE TESTING UNIT TESTING INT...
Department for Work & Pensions 27
From Monolith to Microservices by Andrew Rea
WHEN SHOULD THE TEAM DEPLOY?
WHEN CAN THE T...
Department for Work & Pensions 28
From Monolith to Microservices by Andrew Rea
A LOT OF THIS IS NOT NEW
GOOD DESIGN PRACTI...
Department for Work & Pensions 29
From Monolith to Microservices by Andrew Rea
CHEAT SHEET
EXTERNAL
INTERNAL
AGGREGATION
C...
Upcoming SlideShare
Loading in …5
×

Dwp from monolithtomicroservices

95 views

Published on

A presentation I did whilst working at the DWP to introduce the teams to the Microservices.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Dwp from monolithtomicroservices

  1. 1. Department for Work & Pensions 1 From Monolith to Microservices by Andrew Rea
  2. 2. Department for Work & Pensions 2 From Monolith to Microservices by Andrew Rea Know your Monolith API CONUSMERS APPLICATION DATABASE API BUSINESS LOGIC DATA ACCESS PRESENTATION APIAPI DATABASE Service 1 Service 2 Service “n” DB DB DB Service 1 Service 2 Service “n” Access Postgres MSSQL WORD DOCUMENT EXCEL DOCUMENT VBA APPLICATION UI Business Logic Data Access Database Logging Reports Open Monolith Database Monolith Distributed Monolith Paper Monolith Office Monolith Closed Monolith
  3. 3. Department for Work & Pensions 3 From Monolith to Microservices by Andrew Rea That’s another fine mess you’ve gotten me into APPLICATION DATABASE CODE CODECODE CODE TABLE TABLETABLE TABLE STRONG CODE COUPLING STRONG DB COUPLING DATABASE COUPLING NO DOMAIN BOUNDARIES IMPLICIT RELATIONSHIPS
  4. 4. Department for Work & Pensions 4 From Monolith to Microservices by Andrew Rea That’s another fine mess you’ve gotten me into APPLICATION DATABASE CODE CODECODE CODE TABLE TABLETABLE TABLE £ £ £ INCREASES COST INCREASES IMPLEMENTATION TIME DECREASES VELOCITY INCREASES RISK INCREASES DEPLOYMENT SIZE INCREASES COMPLEXITY INCREASES CODE FEAR INCREASES BUILD TIME INCREASES TEST TIME
  5. 5. Department for Work & Pensions 5 From Monolith to Microservices by Andrew Rea Microservices? APPLICATION DATABASE SERVICE SERVICESERVICE SERVICE TABLE TABLE TABLE TABLE NOT YET 
 BUT… THIS IS MANAGEABLE
  6. 6. Department for Work & Pensions 6 From Monolith to Microservices by Andrew Rea APPLICATION DATABASE SERVICE SERVICESERVICE SERVICE TABLE TABLE TABLE TABLE Microservices? NOT YET BUT… THIS IS MANAGEABLE LOOSE COUPLING HIGH COHESION ENCAPSULATION DATABASE DECOUPLING DOMAIN BOUNDARIES EXPLICIT RELATIONSHIPS SERVICE INTEGRATION SERVICE COMPOSITION
  7. 7. Department for Work & Pensions 7 From Monolith to Microservices by Andrew Rea What are Microservices? SMALL HOW SMALL? INTEROPERABLE HOW? INDEPENDENT HOW? A REASON TO RE-STRUCTURE YOUR TEAMS WHY? RESILIENT HOW?
  8. 8. Department for Work & Pensions 8 From Monolith to Microservices by Andrew Rea How do you get there? GOOD DESIGN PRACTICES
 & PRINCIPLES
  9. 9. Department for Work & Pensions 9 From Monolith to Microservices by Andrew Rea SEPARATE PROCESS PER SERVICE APPLICATIONS DATABASES TABLE TABLE EASIER TO ADOPT DIFFERENT TECH INDEPENDENTLY HOSTED INDEPENDENTLY DEPLOYABLE INDEPENDENTLY SCALABLE SERVICE SERVICE SERVICE SERVICE GRAPH KEY / VALUEDOC
  10. 10. Department for Work & Pensions 10 From Monolith to Microservices by Andrew Rea INDEPENDENT - HOW? DEVELOP INDEPENDENTLY DEPLOY INDEPENDENTLY BUILD INDEPENDENTLY OPERATE INDEPENDENTLY MONITOR INDEPENDENTLY SURVIVE INDEPENDENTLY VERSION INDEPENDENTLY PROCESS CONTINUOUS INTEGRATION CODE REPOSITORY DATA STORES CONTAINER IMAGE SERVICE DISCOVERY DNS (A-RECORD) QUEUES PROVISIONING SCRIPTS CERITIFICATES LOGICAL Encapsulation Boundary REQUIREMENTS LOAD BALANCER POOL MONITORING GROUP SERVICE PHYSICAL Encapsulation Boundary VERSION
  11. 11. Department for Work & Pensions 11 From Monolith to Microservices by Andrew Rea INTEROPERABLE - HOW? COMMON TRANSPORT PROTOCOL RESTFUL API PUBLISH AND SUBSCRIBE CAPABILITY EVENT STREAM STRUCTURED LOGGING IN COMMON FORMAT SERVICE RESTFUL API OVER HTTPS COMMANDS QUERIES EVENTS STD OUTMETRICS STD ERROR LOG AGENT LOG AGGREGATOR
  12. 12. Department for Work & Pensions 12 From Monolith to Microservices by Andrew Rea SEPARATE SERVICES BY BUSINESS CAPABILITY SERVICE DOMAIN 1 DOMAIN 2 DOMAIN 3 SERVICE 1 DOMAIN 1 SERVICE 2 DOMAIN 2 SERVICE 3 DOMAIN 3 Monolith Microservices
  13. 13. Department for Work & Pensions 13 From Monolith to Microservices by Andrew Rea HOW DO THEY SCALE? SERVICE DOMAIN 1 DOMAIN 2 DOMAIN 3 SERVICE DOMAIN 1 SERVICE DOMAIN 2 SERVICE DOMAIN 3 SERVICE DOMAIN 1 DOMAIN 2 DOMAIN 3 SERVICE DOMAIN 1 DOMAIN 2 DOMAIN 3 SERVICE DOMAIN 3 SERVICE DOMAIN 1 SERVICE DOMAIN 3 SERVICE DOMAIN 3 SERVICE DOMAIN 3 SERVICE DOMAIN 2 SERVICE DOMAIN 2 SERVICE DOMAIN 1 Monolith Microservices SAVES MONEY
  14. 14. Department for Work & Pensions 14 From Monolith to Microservices by Andrew Rea DOES THIS HELP SECURITY? WE CAN DEPLOY SEPARATE INSTANCES OF THE SAME SERVICE IN DIFFERENT SECURITY ZONES TO MATCH THE SENSITIVITY OF THE DATA WHICH THE SERVICE INSTANCE WILL BE HANDLING. TRUST 1 TRUST 2 SERVICE SEARCH SERVICE SEARCH SERVICE SEARCH SERVICE SEARCH SERVICE SEARCH SERVICE BOOKING SERVICE BOOKING SERVICE BOOKING SERVICE AVAILABILITY SERVICE AVAILABILITY SERVICE AVAILABILITY SERVICE AVAILABILITY DMZ SERVICE SEARCH SERVICE BOOKING SERVICE AVAILABILITY
  15. 15. Department for Work & Pensions 15 From Monolith to Microservices by Andrew Rea SEPARATE BUILD PIPELINES SERVICE 1 SERVICE 2 SERVICE 3 COMMIT FUNCTIONAL NON-FUNCTIONAL SMOKE TESTSRELEASE SERVICE 1 SERVICE 1 SERVICE 1 SERVICE 1 INDEPENDENT BUILD PIPELINES INDEPENDENT BUILD SCRIPTS INDEPENDENT PROVISION SCRIPT ISOLATED TEST ENVIRONMENTS
  16. 16. Department for Work & Pensions 16 From Monolith to Microservices by Andrew Rea SEPARATE SOURCE CONTROL SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE GIVE EACH SERVICE ITS OWN SOURCE REPOSITORY
  17. 17. Department for Work & Pensions 17 From Monolith to Microservices by Andrew Rea SEPARATE SOURCE CONTROL GIVE EACH SERVICE ITS OWN SOURCE REPOSITORY TEAMTEAM TEAM SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE SERVICE Who
 Owns
 This?
  18. 18. Department for Work & Pensions 18 From Monolith to Microservices by Andrew Rea A REASON TO RESTRUCTURE YOUR TEAMS SERVICE AVAILABILITY SERVICE BOOKING SERVICE SEARCH SERVICE PROVIDERS SERVICE SEARCH SERVICE PROVIDERS SERVICE AVAILABILITY SERVICE BOOKING SERVICE (NOT COMPONENT) TEAMS FEATURE TEAMS OR BOTH?BOTH CAN PLAY A VALUABLE PART IN A MICROSERVICES ARCHITECTURE
 BOTH HAVE THE SAME TEAM STRUCTURE PULL REQUESTS ANYONE?
  19. 19. Department for Work & Pensions 19 From Monolith to Microservices by Andrew Rea HOW SMALL (OR LARGE)? 2000 LINES OF CODE? TWO PIZZA TEAM SIZE? CAN BE RE-WRITTEN IN TWO WEEKS? MODELS A SINGLE CONTEXT? HOW ABOUT ALL OF THE ABOVE? What thought processes do the above questions trigger about your design? TOO BIG? MAKE SMALLER, TOO SMALL? MAKE BIGGER
  20. 20. Department for Work & Pensions 20 From Monolith to Microservices by Andrew Rea HOW DO THEY COMMUNICATE CALL CALL CALL SERVICE DOMAIN 1 SUBSCRIBE SUBSCRIBE SUBSCRIBE CALL CALL CALL OR BOTH DIRECT INVOCATION EVENT DRIVEN SERVICE DOMAIN 1 SERVICE DOMAIN 2 SERVICE DOMAIN 3 SERVICE DOMAIN 4 SERVICE DOMAIN 2 SERVICE DOMAIN 3 SERVICE DOMAIN 4
  21. 21. Department for Work & Pensions 21 From Monolith to Microservices by Andrew Rea WHAT ABOUT MONITORING? CALL CALL CALL META ENDPOINTS MESSAGE CORRELATION SYNTHETIC MONITORING HEALTH CHECK METRICS INFORMATION STRUCTURED LOGGINGBUSINESS APPLICATION INFRASTRUCTURENETWORK LOCAL -> AGENT -> REMOTE
  22. 22. Department for Work & Pensions 22 From Monolith to Microservices by Andrew Rea HOW DO CONSUMING APPS GET STABILITY? SERVICE DOMAIN 1 Stable Next Latest CONSUMER A DEVELOPERS VERSIONS WITH DIFFERENT LEVELS OF STABILITY Consuming “Stable” in Production Testing integration with “Next” Researching “Latest”
  23. 23. Department for Work & Pensions 23 From Monolith to Microservices by Andrew Rea HOW TO VERSION THE SERVICES? <MAJOR>.<MINOR>.<PATCH>-<TAG> https://medium.com/javascript-scene/software-versions-are-broken-3d2dc0da0783#.wcyli1rt2 http://semver.org <BREAKING>.<FEATURE>.<FIX>-<TAG> EXAMPLES v1.0.1 v2.0.1-alpha v2.0.1-beta v2.1.0-latest
  24. 24. Department for Work & Pensions 24 From Monolith to Microservices by Andrew Rea RESILIENT? DOWNSTREAM
 SYSTEMS CIRCUIT BREAKER CONFIRMATION BULK HEADS HEALTH CHECKS ALIVE READY EXTERNAL PERSISTENCE ACKNOWLEDGEMENT STATE EVENTS STATELESS AUTO-RECOVERY
  25. 25. Department for Work & Pensions 25 From Monolith to Microservices by Andrew Rea RESILIENT? DOWNSTREAM
 SYSTEM DOWNSTREAM
 SYSTEM TEST HARNESS SWITCH OUT REAL
 SYSTEM WITH A HARNESS RANDOM STATUS CODE TEST HARNESS SLOW RESPONSE TEST HARNESS HUGE RESPONSE TEST HARNESS EMPTY RESPONSE TEST HARNESS BAD GATEWAY RESPONSE TEST NO RESPONSE TEST HARNESS HOW WILL THE SERVICE RESPOND
 TO ABNORMAL SYSTEM DEPENDENCIES?
 
 LETS FIND OUT BEFORE WE GO LIVE!
  26. 26. Department for Work & Pensions 26 From Monolith to Microservices by Andrew Rea RESILIENT? SERVICE TESTING UNIT TESTING INTEGRATION TESTINGACCEPTANCE TESTING MUTATION TESTING FUZZING TESTINGSTATIC CODE ANALYSIS PERFORMANCE TESTING LOAD TESTING STRESS TESTING IMPULSE TESTING LONGEVITY TESTING FAILURE TESTING SECURITY TESTING SMOKE TESTING RELEASE TESTING ROLLBACK TESTING FUNCTIONAL CROSS FUNCTIONAL
  27. 27. Department for Work & Pensions 27 From Monolith to Microservices by Andrew Rea WHEN SHOULD THE TEAM DEPLOY? WHEN CAN THE TEAM DEPLOY?
  28. 28. Department for Work & Pensions 28 From Monolith to Microservices by Andrew Rea A LOT OF THIS IS NOT NEW GOOD DESIGN PRACTICES 
 & PRINCIPLES BUT THEY DON’T COME FOR FREE!
  29. 29. Department for Work & Pensions 29 From Monolith to Microservices by Andrew Rea CHEAT SHEET EXTERNAL INTERNAL AGGREGATION CORRELATION VISUALIZATION REPORTING API LOGGING DATA MESSAGING APPLICATION INTEGRATION OPERATION HTTPS XML JSON SOAP REST THROTTLING AUTHENTICATION AUTHORIZATION CIRCUITBREAKER INSPECTION ROUTING CIRCUITBREAKER BULKHEADS CIRCUITBREAKER BULKHEADS BULKHEADS RELIABLEMESSAGING DURABLEMESSAGING HEALTH DEPLOYMENT SERVICE REGISTRATION CONFIGURATION READINESS CHECKS STRUCTURED LOGGING TIMESERIES BUSINESS APPLICATION INFRASTRUCTURE NETW ORK ERRORCATALOG EVENTCATALOG INFORMATION DISCOVERABLE API BACKUP SECURITYSECURITY SECURITY TESTHARNESSES CONTINUOUS INTEGRATION CODE REPOSITORY DATA STORES Application Identity PROTECTIVE MONITORING COMMANDS QUERIES EVENTS DOMAIN MODEL DOMAIN SERVICES VERSIONING DOMAIN EVENTS CORRELATION ID SERVICE DEPENDENCIES SUBSCRIBING SERVICES HORIZONTAL SCALING FAILOVER RECOVERY PUBLISH EVENT LOG SUBSCRIBE SECURITY KEY SECURITY ENCRYPTION IN TRANSIT ENCRYPTION AT REST SECURE DEVELOPMENT, DEPLOYMENT & OPERATIONAL PRACTICES AND PRINCIPLES CONTAINER IMAGE CONSISTENCY BOUNDARY API GATEWAY SERVICE FABRIC SERVICE REGISTRY LOAD BALANCER W RITESTORE READ STORE(S) REVERSE PROXY INSPECTION APPLICATION FIREWALLS INSPECTION ENCAPSULATION BOUNDARY CONTAINER REGISTRY HEXAGANOL ARHCICTECTURE Version 1 Microservices Infograhic by Andrew Rea EXTERNAL MONITORING MONITORING MONITORING ? SERVICE DISCOVERY DATA STOREISOLATION AMQP MQTT HTTP other… GRAPH DOCUMENT KEY/VALUE RELATIONAL COLUMN FLATFILE

×