Don’t start with a monolith
… when your goal is a microservices architecture
如果你的目标是微服务,就不要从单体应用开始。
In the last few months, I’ve heard repeatedly that the only way to get to a successful microservices architecture is by starting with a monolith first. To paraphrase Simon Brown: If you can’t build a well-structured monolith, what makes you think you can build a well-structured set of microservices? The most recent – and, as usual, very convincing – rendering of this argument comes from Martin Fowler on this very site. As I had a chance to comment on an earlier draft, I had some time to think about this. And I did, especially because I usually find myself in agreement with him, and some others whose views I typically share seemed to agree with him, too.
最近几个月里,我多次听说要成功架构微服务的唯一方法是从单体应用开始。用Simon Brown的话说:如果你不能构建一个架构清晰的单体应用,你怎么能相信你能构建一个架构清晰的微服务呢?最近在Martin Fowler的个人网站上对此话题也有所讨论。
I’m firmly convinced that starting with a monolith is usually exactly the wrong thing to do.
Starting to build a new system is exactly the time when you should be thinking about carving it up into pieces. I strongly disagree with the idea that you can postpone this, as expressed by Sam Newman, again someone I agree with 95% of the time:
I remain convinced that it is much easier to partition an existing, “brownfield” system than to do so up front with a new, greenfield system. You have more to work with. You have code you can examine, you can speak to people who use and maintain the system. You also know what ‘good’ looks like - you have a working system to change, making it easier for you to know when you may have got something wrong or been too aggressive in your decision making process.
— Sam Newman
阅读全文