j1 2015 "building a microservice ecosystem: some assembly still required"
TRANSCRIPT
![Page 1: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/1.jpg)
Building a Microservice Ecosystem:Some Assembly (Still) Required
Daniel Bryant@danielbryantuk
![Page 2: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/2.jpg)
02/05/2023 @danielbryantuk
Agenda
• What is a microservice platform/ecosystem• Local development of services can be hard• Think about your build pipeline(s)• Testing requires a paradigm shift• Consider the infrastructure• Plan for the inevitable…
![Page 3: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/3.jpg)
02/05/2023 @danielbryantuk
Who Am I?
• London Java Community Associate
• Adopt OpenJDK and JSR
• InfoQ Editor, DZone MVB, Voxxed
• Principal Consultant at OpenCredo• Technical/digital transformation• Java, Golang, CI/CD, DevOps• Microservices, cloud and containers• Maintainer of muservicesweekly.com
![Page 4: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/4.jpg)
02/05/2023 @danielbryantuk
So, What is a Microservice?
“Loosely coupled service oriented architecture with bounded contexts”
Adrian Cockcroft
“Applications that fit in your head”James Lewis
![Page 5: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/5.jpg)
02/05/2023 @danielbryantuk
What do I mean by ‘ecosystem’?
• Build– Local development, pipelines and integration
• Test– From local integration to E2E
• Deploy• Operate • Observe– Monitoring/logging/alerting
![Page 6: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/6.jpg)
02/05/2023 @danielbryantuk
Adrian Cockcroft’s Thoughts
www.slideshare.net/adriancockcroft/microxchg-microservices
![Page 7: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/7.jpg)
02/05/2023 @danielbryantuk
Alexis Richardson’s Thoughts
gotocon.com/goto-london-2015/#!#schedulePopupExtras-7011
![Page 8: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/8.jpg)
02/05/2023 @danielbryantuk
Joe Beda’s Thoughts
www.eightypercent.net/post/layers-in-the-stack.html
![Page 9: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/9.jpg)
02/05/2023 @danielbryantukwikibon.com/wp-content/uploads/container_implementations.png
Technology Choices
![Page 10: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/10.jpg)
02/05/2023 @danielbryantuk
![Page 11: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/11.jpg)
02/05/2023 @danielbryantuk
Core (up front?) Decisions
• Platform– Cloud Foundry– Amazon ECS, Deis, Flynn– Docker Swarm (Tutum)– Kubernetes– Mesos– HashiCorp Nomad– DIY (maybe leverage Netflix’s stuff?)
![Page 12: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/12.jpg)
02/05/2023 @danielbryantuk
Core (up front?) Decisions
• Packaging– Services/tasks/jobs– ’buildpacked’– VMs– Containers
• Is Docker a de facto standard?…
![Page 13: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/13.jpg)
02/05/2023 @danielbryantuk
Build
![Page 14: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/14.jpg)
02/05/2023 @danielbryantuk
Developing Locally: The Basics
• GitHub’s Boxen (Puppet)• Pivotal’s Sprout (Chef)• Mac-dev-playbook (Ansible)
• Vagrant (Otto?)• Docker Compose (Docker machine)
![Page 15: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/15.jpg)
02/05/2023 @danielbryantuk
Developing Locally
• The naïve approach– Replication of env per service– …and dependencies and data stores and...– Soon gets crazy
• Local profiles + mocking/stubbing– Spring profiles + Mockito etc
![Page 16: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/16.jpg)
02/05/2023 @danielbryantuk
Developing Locally
• Service virtualisation– Mountebank, Wiremock (Saboteur), Mirage
• ‘Production-in-a-box’ (IFTTT)– Docker Compose, Vagrant, cf_nise_installer
• Environment leasing– Create your own env (e.g. Hailo)
![Page 17: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/17.jpg)
02/05/2023 @danielbryantuk
Developing Locally
www.opencredo.com/2015/09/20/working-locally-with-microservices/
![Page 18: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/18.jpg)
02/05/2023 @danielbryantuk
Create a Pipeline
![Page 19: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/19.jpg)
02/05/2023 @danielbryantuk
Multi-service / Multi-pipeline?
?
![Page 20: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/20.jpg)
02/05/2023 @danielbryantuk
Test
![Page 21: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/21.jpg)
02/05/2023 @danielbryantuk
Always Remember…
blog.bbv.ch/2012/06/13/acceptance-test-driven-development/
![Page 22: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/22.jpg)
02/05/2023 @danielbryantuk
Testing Basics
• Toby Clemson’s article– martinfowler.com/articles/microservice-testing
![Page 23: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/23.jpg)
02/05/2023 @danielbryantuk
Multi-service / Multi-pipeline?
?
![Page 24: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/24.jpg)
02/05/2023 @danielbryantuk
Pipeline
• Multiple pipelines?– Beware of rubber stamping (distributed monolith)– ‘semver’ if you must (semver.org) e.g. 1.2.1
• Shared staging– Critical path testing (why not prod?)
• Ensured consistency– Consumer-based contracts– Backwards compatibility
![Page 25: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/25.jpg)
02/05/2023 @danielbryantuk
Integration Testing
• Contracts– Pact-JVM github.com/DiUS/pact-jvm – PACT broker github.com/bethesque/pact_broker – Examples: github.com/mstine/microservices-pact
![Page 26: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/26.jpg)
02/05/2023 @danielbryantuk
My Opinions
• BDD services API– Serenity BDD
• Contract tests (failure is a conversation)
• Component test and unit test (as normal)– Maven surefire/failsafe
• BDD critical paths throughout application– Including API journey
![Page 27: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/27.jpg)
02/05/2023 @danielbryantuk
Final Words on Testing
• Don’t forget the “ilities”
• Security / reliability– ZAP (from the OWASP team)– github.com/continuumsecurity/bdd-security
• Performance / scalability – Jmeter (Jenkins Performance plugin)– flood.io
![Page 28: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/28.jpg)
02/05/2023 @danielbryantuk
Deploy
![Page 29: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/29.jpg)
02/05/2023 @danielbryantuk
Separate Deploy and Release
• Feature flags– Difficult at scale (and distribution)– Enable at ingress
• Incremental (phased) rollout
• Canary vs blue/green
• Avoid datastore migrations (if possible)
![Page 30: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/30.jpg)
02/05/2023 @danielbryantuk
Centralise Configuration
![Page 31: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/31.jpg)
02/05/2023 @danielbryantuk
Centralise Configuration
• Consul & consul-template • Etcd/ZK & confd • Netflix Archaius • Spring Cloud
• Watch out for application rollback!
![Page 32: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/32.jpg)
02/05/2023 @danielbryantuk
Operate
![Page 33: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/33.jpg)
02/05/2023 @danielbryantuk
Building Blocks
• Standardise on an OS– Amazon Linux vs mainstream distros
• HashiCorp Terraform– VMWare? cloud-init and vcloud-tools – “Boot my secure government cloud”
• “CAPS”– Chef, Ansible, Puppet, SaltStack– Automated sysadmin
![Page 34: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/34.jpg)
02/05/2023 @danielbryantuk
DevOps and Programmable Infra
• It involves programming…
• Introduce SOLID principles
• Good CI/CD principles– Gitflow etc
![Page 35: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/35.jpg)
02/05/2023 @danielbryantuk
Service Discovery
• External– HAProxy / nginx / ELB etc
• Client-side– Netflix Ribbon (with Prana)– ‘Baker Street’ (extending SmartStack)– srv-router
• Kubernetes and CF are good to go
![Page 36: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/36.jpg)
02/05/2023 @danielbryantuk
Service Discovery
![Page 37: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/37.jpg)
02/05/2023 @danielbryantuk
External
![Page 38: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/38.jpg)
02/05/2023 @danielbryantuk
Client-side
![Page 39: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/39.jpg)
02/05/2023 @danielbryantuk
Service Discovery
• External– HAProxy / nginx / ELB etc
• Client-side– Netflix Ribbon (with Prana)– ‘Baker Street’ (extending SmartStack)– srv-router
• Kubernetes and CF are good to go
![Page 40: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/40.jpg)
02/05/2023 @danielbryantuk
Observe
![Page 41: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/41.jpg)
02/05/2023 @danielbryantuk
Monitoring and People
www.infoq.com/news/2015/06/too-big-to-fail
![Page 42: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/42.jpg)
02/05/2023 @danielbryantuk
Start with the Basics
• Health checks– Coda Hale (DropWizard) Metrics– Spring Boot actuator
• KPIs for apps (and business)– Assertions / invariants– Throughput– Queue length
![Page 43: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/43.jpg)
02/05/2023 @danielbryantuk
Logging
• “What every engineer should know”
• “10 Tips for Proper Application Logging”
• ElasticSearch-Logstash-Kibana (ELK)– Buffer/proxy log sending or…– Mount directory into container
![Page 44: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/44.jpg)
02/05/2023 @danielbryantuk
Kibana FTW
![Page 45: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/45.jpg)
02/05/2023 @danielbryantuk
Distributed Tracing
• github.com/daniel-bryant-uk/correlation-id-async• MDC logging (logback.qos.ch/manual/mdc.html )• Zipkin/Brave (github.com/openzipkin/docker-zipkin )
![Page 46: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/46.jpg)
02/05/2023 @danielbryantuk
Monitoring• Push– Spring Boot actuator e.g. InfluxDbExporter
• Pull – E.g. Telegraf (shout to Tareq Abedrabbo)
• InfluxDB vs prometheus vs graphite vs opentsdb
• Information radiators– Aggregate vs individual
![Page 47: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/47.jpg)
Aggregation: Sick Cattle, Not Sick Pets
![Page 48: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/48.jpg)
02/05/2023 @danielbryantuk
Grafana FTW
![Page 49: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/49.jpg)
02/05/2023 @danielbryantuk
Problems?
• Rob Ewaschuk’s “Philosophy on Alerting”
• Brendan Gregg’s USE method – “check utilization, saturation, and errors.”
• “DevOps Troubleshooting”– Kyle Rankin
![Page 50: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/50.jpg)
02/05/2023 @danielbryantuk
Summary
• Looked at “microservice platforms”• Local development of 3+ services is hard• Think about your build pipeline(s)• Testing requires a paradigm shift• Consider the infrastructure• Plan for the inevitable issues…• Try not to create your own platform...
![Page 51: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/51.jpg)
02/05/2023 @danielbryantuk
![Page 52: J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"](https://reader036.vdocument.in/reader036/viewer/2022062503/58f0aa761a28ab0f108b4579/html5/thumbnails/52.jpg)
02/05/2023 @danielbryantuk
Thanks
Feedback is always welcomed!
[email protected]@danielbryantuk
www.muservicesweekly.com