微服务与整体架构 [英] Microservices vs Monolithic Architecture

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

问题描述

我读了一些关于微服务的文章,我对此有些兴趣,好像是一个有趣的概念.但是我想知道,使用微服务相对于单片架构有什么优点和缺点,反之亦然.

I did some reading about microservices, and I'm little bit intrigued.Seems like it is interesting concept. But I wonder, what are advantages and disadvantages using microservices over monolithic architecture, and vice versa.

什么时候微服务更合适,单片架构更适合.

When microservices suitable better, and where better to go with monolithic architecture.

推荐答案

虽然我是微服务领域的新手,但我会尽力回答您的问题.

While I'm relatively new to the microservices world, I'll try to answer your question as complete as possible.

当您使用微服务架构时,将增加关注点的分离和分离.既然您正在拆分应用程序.

When you use the microservices architecture, you will have increased decoupling and separation of concerns. Since you are litteraly splitting up your application.

这导致您的代码库更易于管理(每个应用程序都独立于其他应用程序,以保持运行状态).因此,如果您这样做正确,将来更容易向您的应用程序添加新功能.而采用单片式架构,如果您的应用程序很大(可能会在某个时间点假设),这可能会变得非常困难.

This results into that your codebase will be easier to manage (each application is independent of the other applications to stay up and running). Therefore, if you do this right, it will be easier in the future to add new features to your application. Whereas with a monolithic architecture, it might become a very hard thing to do if your application is big (and you can assume at some point in time it will be).

部署应用程序也更容易,因为您要分别构建独立的微服务并将其部署在单独的服务器上.这意味着您可以随时构建和部署服务,而不必重新构建其余的应用程序.

Also deploying the application is easier, since you are building the independent microservices separately and deploying them on separate servers. This means that you can build and deploy services whenever you like without having to rebuild the rest of your application.

由于不同的服务规模较小且分别部署,因此很明显易于扩展,其优势在于您可以扩展应用程序的特定服务(使用整体式,可以扩展完整的内容" ,即使只是应用程序中的特定部分会承受过多的负担.

Since the different services are small and deployed separately, it's obvious easier to scale them, with the advantage that you can scale specific services of your application (with a monolithic you scale the complete "thing", even if it's just a specific part within the application that is getting an excessive load).

但是,对于那些将来不会变得太大而无法管理的应用程序.最好将其保留在整体架构中.由于微服务架构涉及一些严重的困难.我说过,部署微服务比较容易,但这仅与大型组件相比才是正确的.使用微服务会增加将服务分发到不同位置的不同服务器的复杂性,并且您需要找到一种方法来管理所有这些服务.从长远来看,如果您的应用程序变大,构建微服务将对您有帮助,但是对于较小的应用程序,保持单一是很容易的.

However, for applications that are not intended to become too big to manage in the future. It is better to keep it at the monolithic architecture. Since the microservices architecture has some serious difficulties involved. I stated that it is easier to deploy microservices, but this is only true in comparison with big monoliths. Using microservices you have the added complexity of distributing the services to different servers at different locations and you need to find a way to manage all of that. Building microservices will help you in the long-run if your application gets big, but for smaller applications, it is just easier to stay monolithic.

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

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