Microservice based or Monolithic

亡梦爱人 提交于 2019-12-23 17:51:07

问题


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

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?


回答1:


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.

To sum up this principal:

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

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...

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).

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.

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

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.




回答2:


For your project a microservice architecture seems like overkill. Microservices do have a lot of benefits, but they do have a lot of operational overhead and add a lot of complexity in terms of distributed services.

It sounds like you also only have one primary requirement which is to pull news, in which case all the news-related services will form part of one microservice in any case.

Once you start adding more distinct requirement domains you could look at building them as separate microservices. Even then it might be prudent to modularize the functionality into components within the same service, and as your application and system starts to grow split the functionality out into separate microservices.




回答3:


Creating a Micro Service will definitely help you in future because of the following reasons below:

  1. Scalability: Micro services can scale independently without disturbing other Micro Services used in the application.

  2. Agility: Changes in a micro service can be very quickly, thus accommodating rapidly changing business scenarios.

  3. Fault Tolerance: Even if one micro service fails, other micro services can keep servicing thus minimizing impact on the overall application

  4. Polyglot persistence: Each micro service can decide its own type of Database mechanism.

I have covered advantages of micro services partially here, there are still more.

Thus if you look at all the points above, is definitely worthy creating micro services application



来源:https://stackoverflow.com/questions/35913253/microservice-based-or-monolithic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!