基于微服务或单片 [英] Microservice based or Monolithic

查看:106
本文介绍了基于微服务或单片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读了很多有关微服务及其结构的文章,看来在可维护性方面有很多优点.

I read a lot about Microservices and their structure and it seems, that there are a lot of advantages when it comes to maintainability.

我想用Spring Boot和Phonegap构建一个移动应用程序,以从RESTful Web服务中获取新闻.

I want to build a mobile app with Spring Boot and Phonegap, which pulls news from RESTful Web Services.

因此,我正在考虑将其构建为微服务,以便可以添加其他服务而无需重建整个应用程序.因为将来我可能想添加其他服务.

So I'm thinking f building it as a microservice so I can add other services without rebuilding the whole application. Because in future I might want to add other services.

但是,为如此小的移动应用程序构建基于微服务的应用程序真的值得吗?

But is it really worth to build a Microservice based application for such a small mobile app?

推荐答案

Fowler发表了很好的文章,他提出许多以基于微服务的设计开始的项目很快就会遇到问题.相反,许多成功的基于微服务的应用程序都是从整体开始的.

There is a good article by Fowler, in which he poses that many projects which start off with a microservice-based design run into problems very quickly. Conversely, many successful microservice-based applications are the ones which began life as a monolith.

总结这个原则:

...您不应该使用微服务来启动新项目,即使 您确定您的应用程序将足够大以使其值得.

...you shouldn't start a new project with microservices, even if you're sure your application will be big enough to make it worthwhile.

尽管福勒没有对此发表自己的个人看法,但他确实在推测他所说的 Monlith-First 的好处.

While Fowler does not express his personal opinion on this, he does speculate on the benefits of what he calls Monlith-First.

...采用整体优先的策略,您应该在其中构建新的应用程序 最初是一个整体,即使您认为很可能会 稍后将受益于微服务架构...可能很难扩展 设计不良但成功的软件系统,但这仍然是 比倒数更好的地方...您需要优先考虑速度...

...a monolith-first strategy, where you should build a new application as a monolith initially, even if you think it's likely that it will benefit from a microservices architecture later on...It may be hard to scale a poorly designed but successful software system, but that's still a better place to be than its inverse...you need to prioritize speed...

因此,采用"Monlith-First"方法的好处是您可以快速构建整体,因为通常要求是众所周知的且相对较少.此外,您可以快速将产品推向市场,从而可以了解您的应用程序及其在现实世界中的行为.

So, the benefits of the Monlith-First approach is that you can build a monolith quickly because generally the requirements are well known and relatively few. Additionally, you get something to market fast so then you get to understand your application and how it behaves in the real world.

令我震惊的主要好处是,与您试图预先定义这些边界(这是必要且非常重要的)相比,您将更清楚地了解所支持的业务功能之间的界限自然属于您的应用程序基于微服务的设计中的设计步骤).

What stikes me as the main benefit is that you will more clearly understand where the boundaries between the business capabilities you are supporting naturally fall within your application, than if you had tried to define these boundaries up front (a necessary and very important design step in microservice-based designs).

他继续介绍如何有效规划Monolith-first设计,该设计主要涉及保持代码美观和模块化,并着眼于将来根据需要突破模块.

He goes onto expand on how you can effectively plan a Monolith-first design, which basically involves keeping your code nice and modular with an eye on the future breaking-out of modules as required.

...仔细设计一个整体,注意内部的模块化 在API边界以及如何存储数据的软件.

...design a monolith carefully, paying attention to modularity within the software, both at the API boundaries and how the data is stored.

根据我的经验,基于服务的方法非常适合与业务领域专家一起花费大量的前期分析时间,并且拥有一个成熟的交付团队,他们通常会与soa和基于服务的团队一起工作.

In my experience a services-based approach works well with a lot of up-front analysis time spent with business domain experts, and a mature delivery team who are comfortable working with soa and service-based in general.

这篇关于基于微服务或单片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆