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 的節(jié)點,而core network 只是負責傳輸數(shù)據(jù)庶柿。 這點其實思想跟 network 是一樣的
Consumer-Driven Contract
test upstream service to avoid end-end test
這樣你test 如果出錯你就知道你新的 code 就會 break upstream service