managing microservices in production with lagom
TRANSCRIPT
![Page 1: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/1.jpg)
Managing Microservices in Production with Lagom
by Christopher Hunt (@huntchr)
![Page 2: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/2.jpg)
Hybrid Cloud
![Page 3: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/3.jpg)
Recap
![Page 4: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/4.jpg)
•Reactive Microservices framework for the JVM • Focus on right sized services • Asynchronous IO and communication as first class •Highly productive development environment • Takes you through to production deployment
Lagom for Java Enterprises
![Page 5: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/5.jpg)
Today
![Page 6: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/6.jpg)
•Deploy Chirper on 3 EC2 nodes • Lagom, ConductR and 12 factor apps
Lagom for Devops
![Page 7: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/7.jpg)
Deploy
![Page 9: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/9.jpg)
I. Codebase One codebase tracked in revision control, many deploys
![Page 10: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/10.jpg)
• Lagom • single repository • many services per “project”
I. Codebase
![Page 11: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/11.jpg)
II. Dependencies Explicitly declare and isolate dependencies
![Page 12: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/12.jpg)
•Bundles • self contained • verifiable and immutable • Docker and other containers • meta info including ACLs, resource requirements and startup config
II. Dependencies
![Page 13: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/13.jpg)
III. Config Store config in the environment
![Page 14: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/14.jpg)
• separate • verifiable and immutable • per bundle or across bundles
III. Config
![Page 15: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/15.jpg)
IV. Backing services Treat backing services as attached resources
![Page 16: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/16.jpg)
• no distinction to other services • local or remote services • service location • Amazon RDS, external service, JDBC (dynamic-data-source)
IV. Backing services
![Page 17: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/17.jpg)
V. Build, release, run Strictly separate build and run stages
![Page 18: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/18.jpg)
• build - sbt, “bundle:publish”, bintray • release - “conduct load”, resolvers, build artifact + config • run - “conduct run”
V. Build, release, run
![Page 19: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/19.jpg)
VI. Processes Execute the app as one or more stateless processes
![Page 20: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/20.jpg)
• bundle has components, components == process • share-nothing is a bit of a fallacy • DBs are shared • distributed pub-sub • CRDTs
VI. Processes
![Page 21: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/21.jpg)
VII. Port binding Export services via port binding
![Page 22: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/22.jpg)
• bind port • host port • proxy port (if a proxy is required) • *very* sophisticated proxy configuration (again, if required)
VII. Port binding
![Page 23: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/23.jpg)
VIII. Concurrency Scale out via the process model
![Page 24: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/24.jpg)
• scale up down at will • “conduct run x —scale y”
• resilient processes • automatically restarted
VIII. Concurrency
![Page 25: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/25.jpg)
IX. Disposability Maximize robustness with fast startup and graceful shutdown
![Page 26: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/26.jpg)
• replication • fast startup
• graceful termination • 10 seconds - sigkill
• auto scaling • 1.2 • process metrics based • statsd
IX. Disposability
![Page 27: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/27.jpg)
X. Dev/prod parity Keep development, staging, and production as similar as possible
![Page 28: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/28.jpg)
• sandbox cluster for development • uses Docker
• bundle publishing to bintray • resolver mechanism to support other repos
X. Dev/prod parity
![Page 29: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/29.jpg)
XI. Logs Treat logs as event streams
![Page 30: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/30.jpg)
• Elasticsearch • consolidated • “conduct logs”
• syslog
XI. Logs
![Page 31: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/31.jpg)
XII. Admin processes Run admin/management tasks as one-off processes
![Page 32: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/32.jpg)
• runAll for operations •CLI is composable • idempotent • composition the Unix way
XII. Admin processes
![Page 33: Managing Microservices in Production with lagom](https://reader034.vdocuments.us/reader034/viewer/2022051404/587331e21a28ab596c8b6c4b/html5/thumbnails/33.jpg)