Monolith vs micro
monolith is single code repo
micro has different repo and each repo has its own DB
micro services sounds suspiciously like a distributed system
DDD provides a suitable method for identifying microservices
- Bounded Contexts in DDD
Read DDD and Microservice by Eric Evans
Small Autonomous services that work together, modelled around a business domain
- Sam Newman
果然想要深刻理解还是要给出清晰的定义,自己的定义
Principle of Microservices
- Modelled Around business domain
- Culture of Automation
- hide implementation Details
- Decentralise all The Things
- Deploy Independently
- Consumer First
- Isolate Failure
- Highly Observable
Culture of Automation
- Infrastructure Automation
- Automated Testing
- Continuous Delivery
Hide implementation Details
Avoid two services sharing same DB (tight coupling between different services)
keep message queue dumb
这个点跟 network 也很像,因为 edge network 是主要的smart implementation, 也是主要fast iteration 的节点,而core network 只是负责传输数据。 这点其实思想跟 network 是一样的
Consumer-Driven Contract
test upstream service to avoid end-end test
这样你test 如果出错你就知道你新的 code 就会 break upstream service
网友评论