The Paved PaaS to Microservices
Speaker: Yunong Xiao @yunongx
See the list of all blog posts from the conference
Yunong is from Netflix. Talked about how serving multiple types of devices. Can innovate faster if not worrying about infrastructure
Client teams own microservices for front end/client devices. Edge API is server based/back end API
- Common set of components – ex: metrics, logging, alerts, dashboard, configuration
- Don’t want everyone picking RPC mechanism. Invest in one set of tooling
- Benefits of standardizing: consistency (ease of troubleshooting/support), leverage (more time for business problems with platform team focused on components), interoperability (easier integration so faster velocity and less cognitive overload), quality (more investment so higher chance of quality), support (greater knowledge base)
- “But I’m a Snowflake” – Netflix has culture of freedcom and responsibility. Helps with innovation. If works, re-integrate into ecosystem. Be concious of talking to the others and the cost to other teams of your choice.
Starting a new project, there isn’t velocity yet nor stats on reliability.
- Putting components into a pre-assembled platform so can just add business logic. Less likely to be missing things like metrics because in pre-assembled platform.
- Guarantees standard and consistent metrics. Reducs MTTD (mean time to detect) and MTTR (mean time to recover)
- Maintenance vs convenience – easier for platform team to include just basics. Easier for app team to have more included. The solution is layers and favors. Having a base platform and add ons.
- Testing – running other team’s microservices tests when upgrading a platform tests the platform upgrade
- Design for configuration and hooks
- API Semantic versioning (like what Maven versions do)
- Use conventional changelog to automatically creat changelog
Automation and Tooling
- Provide CLI for common dev experience – allows scripting and consistent environment each time. Ensures can run locally and in the cloud
- Local development fast – use local debugger and curl. Can still test with container so mirrors prod config
- Provide first class mocks for components in pre-assembled platform. Facilitate determining where the problem lives. Easier to write reliable automated tests.
- Provide facilitate to generate mock data
- Need a testing API so different groups can work on mocks. Component teams create mocks against standard APIs
- “Production is war” – different levels of experience in ops. Use tools to avoid shooting off own foot. Ex: pipelines for deployment/rollback, automated canary analysis
- Dashboards provide a consolidated view for ops. Having platform generate dashboard and alerts standardizes them. Also allows for automate analytics and tooling.
Provided warning about not just copying Netflix. PaaS is for certain use cases. Components help regardless.
TDD for Microservices Architectures
Speaker: Reshmi Krishna and Vinay Upadhya
See list of all blog posts from conference
Showed Martin Fowler’s testing pyramid (unit, integration, component, end-to-end, exploratory) to set vocabulary
Focus with microservices is contract based testing.
Consumer driven contracts (CDC) let the callers specify exactly what they are interested in from a generic API. If everyone does this, you know who uses what fields so don’t remove something that a caller is relying on.
Spring Cloud Contract
- specifies contracts with Groovy (but mainly DSL so like data structure). Can use other formats such as XML
- Looks like BDD – request/response except HTTP level.
- Contracts stored with app under src/test/resources. Or can store in separate project
- The producer autogenerates stubs/tests and shares with consumer
- Spring Cloud Contract Verifier – checks service isn’t breaking any consumer contracts
- Spring Cloud Contract Wiremock – wrapper around wiremock (wiremock is an API mocking tool)
- Spring Cloud Contract Stub Runner – pulls stubs from maven and run with wiremock
- Client app needs an API/field. Client writes test specifying what need. The test specifies workOffline = true to use local stub
- Client implements code to call the microservice that implements the new feature [This was worded a “client implements the feature” which is not what they meant upon a few questions and confused me. With my wording (about calling the microservice and seeing the code it makes sense that the client is not implmenting the feature]
- Client clones producer repo and define locally – if needed. Or can use common repo for contracts.
- Autogenerates tests/stubs for producer based on contracts. The stubs are wiremock JSON. The tests use JUnit/AssertJ.
- Client runs verifier tests – now they pass
If later version of service, update URL with version number so have new requirements.
The PowerPoint felt a bit rushed, but the demo was a good pace. I would have liked more mapping between the points in the flow. It’s a lot to remember. But it did mostly come together in my mind. Especially after I asked enough questions to uncover the a bullet in the flow wasn’t actually what happens. (So confused me) From the questions, I could tell that others in the audience were wondering about some details as well. Luckily, I had the step in this post for reference!
Microservice s Pattern Language
Speaker: Chris Richardson – @crichardson
See list of all blog posts from conference
Modern software development:moving fast and not breaking things!
Do this with DevOps, Continuous Deployment/Delivery and small autonomous teams
- Not an anti-pattern because it makes sense at one point
- Can deploy frequently at the beginning
- Then it grows. Quickly
- Then ball of mud
- Get stuck with obsolete tech stack that used when started project
- Architectural styles
- set of services
- loosely coupled
- organized around business capabilities
- tackle complexity through modularization
- Improved scalability is secondary (“monoliths can scale quite well”)
- Each service has own private data store/schema (doesn’t need own database)
- Once agree on APIs cn develop with less communication and integration
- Easier to understand develop/test
- Less potential for jar hell
- Start up time faster which imporves MTTR (mean time to recover)
- Know who owns each service – with monolith, everyone is responsible so nobody really is
- Can fail safely with new technology because only affects one service
Downside – Complexity
- Now have messaging/remote calls
- Deal with timeouts and partial failures – circuit breaker pattern
- Multiple databases and transaction management – need series of local transactions
- Queries more complicated – can’t just join with SQL. Need to call multiple APIs or replicate data
- Need a lot of automation; a lot of production applications /services
- New feature needs multiple services to be deployed in right order
Your monolith will grow forever and never get better. Automation makes microservices better. But need some automation as pre-req for successful microservices
- To solve architectural problems
- See patterns on microservices.io
- Chris writing a book on the topic – currently available through Manning Early Access Program (MEAP)
- Example of a pattern for dealing with querying data from multiple sources: CQRS – command query responsibility segregation – see CQRS pattern on web
- Chris is still creating new patterns so remember to check back on the site
Overall, I like that more of the presentation was about microservices than the patterns themselves. It shows why this is important and gives the background to read the patterns. I like the patterns he chose to show.