解构 "单体":设计能够最大限度提高开发人员生产力的软件
Shopify is one of the largest Ruby on Rails codebases in existence. It has been worked on for over a decade by more than a thousand developers. It encapsulates a lot of diverse functionality from billing merchants, managing 3rd party developer apps, updating products, handling shipping and so on. It was initially built as a monolith, meaning that all of these distinct functionalities were built into the same codebase with no boundaries between them. For many years this architecture worked for us, but eventually, we reached a point where the downsides of the monolith were outweighing the benefits. We had a choice to make about how to proceed.
Shopify是现存最大的Ruby on Rails代码库之一。它已经由一千多名开发人员工作了十多年。它封装了很多不同的功能,包括为商家计费、管理第三方开发者应用程序、更新产品、处理运输等等。它最初是作为一个单体应用建立的,这意味着所有这些不同的功能都被建立在同一个代码库中,它们之间没有界限。多年来,这种架构对我们很有效,但最终,我们达到了一个点,即单体的缺点超过了好处。我们不得不选择如何进行。
Microservices surged in popularity in recent years and were touted as the end-all solution to all of the problems arising from monoliths. Yet our own collective experience told us that there is no one size fits all best solution, and microservices would bring their own set of challenges. We chose to evolve Shopify into a modular monolith, meaning that we would keep all of the code in one codebase, but ensure that boundaries were defined and respected between different components.
近年来,微服务的受欢迎程度激增,并被吹捧为解决单体产生的所有问题的最终解决方案。然而,我们自己的集体经验告诉我们,没有一个适合所有的最佳解决方案,微服务会带来他们自己的一系列挑战。我们选择将Shopify发展成一个模块化的单体,这意味着我们将把所有的代码保留在一个代码库中,但要确保不同组件之间的界限得到界定和尊重。
Each software architecture has its own set of pros and cons, and a different solution will make sense for an app depending on what phase of its growth it is in. Going from monolith to modular monolith was the next logical step for us.
每种软件架构都有自己的优点和缺点,不同的解决方案对一个应用程序来说是有意义的,这取决于它处于什么发展阶段。从单体应用到模块化单体应用是我们的下一个逻辑步骤。
Monolithic Architecture
单体应用架构
According to Wikipedia, a monolith is_a software system in which functionally distinguishable aspects are all interwoven, rather than containing architecturally separate components_. What this meant for Shopify...