2018年/04月/19日
微服务五大指导
Designing microservices can often feel more like an art than a science. For engineers, that may not sit well. There’s lots of general advice out there, but at times it can be a bit too abstract. Let’s recap the five specific characteristics to look for when designing your next set of microservices:
- It doesn’t share database tables with another service
- It has a minimal amount of database tables
- It’s thoughtfully stateful or stateless
- Its data availability needs are accounted for
- It’s a single source of truth
Next time you’re designing a set of microservices and determining service boundaries, referring back to these principles should make the task easier.
设计微服务往往会让人感觉更像是一门艺术,而不是一门科学。对工程师来说,这可能并不顺利。有很多一般性的建议,但有时可能有点太抽象了。让我们回顾一下在设计下一组微服务时要注意的五个具体特征:
- 不与其他服务共享数据库表
- 数据库表数量最小化
- 考虑有状态和无状态
- 考虑数据可用性需求
- 单一的真实来源
下次设计一组微服务并确定服务边界时,回顾这些原则应该会使任务变得更容易。