learning from fallacies of microservices - gids 2017(cr040317) · microservice architecture is a...
TRANSCRIPT
Microservices - Definition
Microservice architecture is a method of developing software applications as a suite of independently deployable, small, modular services in which each service runs a unique process and communicates through a well-defined, lightweight mechanism to serve a business goal.
Source : https://smartbear.com/learn/api-design/what-are-microservices/
©2017 PayPal Inc. Confidential and proprietary. 3
Microservices – Definition
ØSmall services
ØUnique process
Ø Lightweight communication mechanisms
ØUnique business capabilities
©2017 PayPal Inc. Confidential and proprietary. 4
Microservices – Definition
Ø Independently deployable
ØDifferent programming languages
ØDifferent data storage technologies.
©2017 PayPal Inc. Confidential and proprietary. 5
Why Microservices?
ØEasier for a developer to understand
ØDevelopment is faster
Ø Independent Deployment - Easier to deploy new versions of services frequently
ØScalability
Ø Improved fault isolation.
ØNo long-term commitment to a technology stack
©2017 PayPal Inc. Confidential and proprietary. 6
©2017 PayPal Inc. Confidential and proprietary. 7
User Service
Cart Service Checkou
t Service
Shipping Service
Payment Service
Catalogue Service
Rating Review Service
Client Layer
Login Service
Why NOT to use Microservices?
ØMicroservices architecture is complicated
Ø If you are a new company
ØDon’t have DevOps support
ØNot facing scalability issues
©2017 PayPal Inc. Confidential and proprietary. 8
©2017 PayPal Inc. Confidential and proprietary. 10
• Using whole lot of network to communicate
User Service
Cart Service Checkou
t Service
Shipping Service
Payment Service
Catalogue Service
Rating Review Service
Client Layer
Login Service
Are these network reliable?
Is latency 0?
Network - Reliability
ØNetwork is not reliable
ØConnections across firewalls
ØCascading failure
©2017 PayPal Inc. Confidential and proprietary. 11
Network – Reliability - Solutions
ØDesign for Failure
ØConstant active monitoring
ØDiscovering Who to Blame
©2017 PayPal Inc. Confidential and proprietary. 12
©2017 PayPal Inc. Confidential and proprietary. 13
• Service Failure
User Service
Cart Service Checkou
t Service
Shipping Service
Payment Service
Catalogue Service
Rating Review Service
Client Layer
Login Service
Service Failure – Design for Failure
ØChaos Monkey (Netflix Example)
©2017 PayPal Inc. Confidential and proprietary. 14
Source : http://techblog.netflix.com/2012/07/chaos-monkey-released-into-wild.html
Service Failure
ØDR Readiness
ØEffective monitoring
©2017 PayPal Inc. Confidential and proprietary. 15
©2017 PayPal Inc. Confidential and proprietary. 16
• Versioning
User Service
Cart Service Checkou
t Service
Shipping Service
Payment Service
Catalogue Service
Rating Review Service
Client Layer
Login Service
Specification change proposal for Payment Service
©2017 PayPal Inc. Confidential and proprietary. 17
V1Checkout Service
V1Payment Service
V1Shipping Service DB1
DB2
©2017 PayPal Inc. Confidential and proprietary. 18
V1Checkout Service
V2Payment Service
V1Shipping Service DB1
DB2
Semantic Versioning
©2017 PayPal Inc. Confidential and proprietary. 19
Major, Minor & Patch
V1.yyCheckout Service
V1.xxPayment Service
V1.zzShipping Service DB1
DB2
Semantic Versioning
©2017 PayPal Inc. Confidential and proprietary. 20
V1.yyCheckout Service
V1.xxPayment Service
V1.zzShipping Service DB1
DB2
V2Payment Service
Semantic Versioning
©2017 PayPal Inc. Confidential and proprietary. 21
V1.yyCheckout Service
V1.xxPayment Service
V1.zzShipping Service DB1
DB2
V2Payment Service
V1.ppCheckoutService
©2017 PayPal Inc. Confidential and proprietary. 24
• Monolith System : Well defined point of access
User Service
Cart Service Checkou
t Service
Shipping Service
Payment Service
Catalogue Service
Rating Review Service
Client Layer
Login Service
Security
ØForm Auth/oAuth
ØConfused deputy attack
ØUnauthorized access to inner services
ØTransport Security
©2017 PayPal Inc. Confidential and proprietary. 25
26
Login Service
User Service
Post Service
User Authenticates and get oAuth Token
Passes oAuth Token to access details
Tries to post something
27
Login Service
User Service
Post Service
User Authenticates as “ABC” and get oAuth Token
Passes oAuth Token to access details of “XYZ”
Tries to post something as “XYZ”
Confused Deputy Problem
©2017 PayPal Inc. Confidential and proprietary. 28
• Transport Security
User Service
Cart Service Checkou
t Service
Shipping Service
Payment Service
Catalogue Service
Rating Review Service
Client Layer
Login Service
Security – Transport Security
ØUse HTTPS
Ø Server side check
Ø Payload is not manipulated
Ø No Client guarantee
©2017 PayPal Inc. Confidential and proprietary. 29
Security – Transport Security
ØClient side certificates
ØClient guarantees
ØQuite cumbersome to manage
©2017 PayPal Inc. Confidential and proprietary. 30
Security – Data Security
ØEncrypt data
ØAdvanced Persistent Threat
ØR-R-R
ØRotate: Short lived credentials
ØRepair: Patch your stuff
ØRepave: Burn it down
©2017 PayPal Inc. Confidential and proprietary. 31
Hardcoded IPs and Ports
©2017 PayPal Inc. Confidential and proprietary. 33
Services are tied to specific IPs and ports. Moving them around requires code changes.
Service Discovery System
©2017 PayPal Inc. Confidential and proprietary. 35
Service A
Service B192.168.0.3:1056
Where is service B?
192.168.0.3:1056
Hey There
Solution: Centralized Router
©2017 PayPal Inc. Confidential and proprietary. 36
Router
Service A
Service A
Service A
Service B
Service B
Service B
Debugging
©2017 PayPal Inc. Confidential and proprietary. 38
ServcieA
ServciceB
Service C
Service D
Service E
Log A Log B Log C Log D Log E
Correlation ID: 1234
Correlation ID: 1234
Correlation ID: 1234 Correlation ID: 1234 Correlation ID: 1234
Correlation ID: 1234 Correlation ID: 1234 Correlation ID: 1234 Correlation ID: 1234
Logs can be mapped to single session/user request via correlation ID
Conclusion
ØDefinition of Microservices
ØTenets of Microservices
ØWhy to use Microservices
ØWhy not to use Microservices
Ø Implementation Fallacies
©2017 PayPal Inc. Confidential and proprietary. 40
Conclusion
ØNetwork Reliability – Effective Monitoring
ØService Failure – Design for failures
ØSemantic versioning of Microservices
ØSecurity – Confused Deputy Attack
ØSecurity – Transport Security
ØSecurity – Data Security (Advanced Persistent Threat)
©2017 PayPal Inc. Confidential and proprietary. 41
Conclusion
ØService Discovery System
ØCentralized Router System
ØDebugging : Correlation ID
©2017 PayPal Inc. Confidential and proprietary. 42