microservices: where spring cloud meets docker and consul
TRANSCRIPT
Dragan [email protected]
MICROSERVICES: WHERE SPRING CLOUD MEETS DOCKER AND CONSUL
MONOLITHIC VS MICROSERVICES 1/2
�Web server
Web app
Web layer
Service/Business layer
Data/Persistence layer
Catalog Order
Customer
Database
Web Shop
SPA
Catalog App
Catalog
Order App
Order
Customer App
Customer
Maintainability
Continuous Deployment
Scalability
Availability
Take advantage of emerging
technologies
Efficient governance
MONOLITHIC VS MICROSERVICES 2/2 code base size increases -> decrease maintainability overloaded IDE -> slow IDE -> decrease productivity overload web server -> long start -> decrease productivity
redeploy the entire app influence background tasks increases the risk -> discourages frequent updates
running more copies of the same app different components have different requirements
small code base size per MS faster IDE WS fast start
each service can be deployed independently smaller aps are easier to deploy downtime
low fault isolation
long time commitment to technology stack
hard to manage large teams agile is not scaling well hard to scale development
improved fault isolation Increased complexity - fail fast
scale on the level of MS
each MS can be developed using different stack
each (2 pizza) team responsible for one MS agile is working well easy to scale development
DISTRIBUTED SYSTEMS
• Configuration• Inter-service
communication• Discovery• Deployment• Orchestration• Testing• Distributed transactions• Versioning
Web Shop
SPA
Catalog App
Catalog
Order App
Order
Customer App
Customer
TO THE RESCUE
DOCKER
• Lightweight virtualization• Images vs containers• Registry• Compose• Machine, Swarm,…
CONSUL
• Distributed key/value store• Service discovery and health
check• Multi Datacenter support• Optimized sync protocols
(gossip)
• Alternatives• Netflix Eureka• Spring Cloud Config
SPRING CLOUD
• Implements common patterns of distributed systems• Distributed configuration• Service discovery• Routing• Service-to-service calls• …
• Build on 12 factor app and Cloud Native principles
• Spring Boot
DEMO
config/appName,dev/config/appName/config/application,dev/config/application
ms-demo-1:/echo ms-demo-2:/echo
ms-caller:/hello
LESSONS LEARNED
• US breakdown• Keep your APIs under control• CD• Automated integration env• E2E automated tests• Don’t underestimate learning curve• After initial phase split the team accordingly
RESOURCES
• http://12factor.net/• http://projects.spring.io/spring-cloud/• http://cloud.spring.io/spring-cloud-consul/
• https://gitlab.levi9.com/d.gajic/ms
ONE COMMON GOAL