简体   繁体   English

基于项目,微服务和服务(在 SOA 中)可以是同一个东西吗?

[英]Can a Microservice and a Service (in SOA) be the same thing based on the project?

There are many sources that explain microservices and SOA.有很多资料可以解释微服务和 SOA。 But the problem is none of them make side-to-side comparisons for the same real-life scenario.但问题是他们都没有对相同的现实生活场景进行横向比较。 Let's assume that we're working on a centralized cryptocurrency exchange.假设我们正在开发一个中心化的加密货币交易所。

Parts of this project:该项目的部分内容:

  • User service (Authentication & Authorization, user profiles, etc.)用户服务(身份验证和授权、用户配置文件等)
  • Wallet service (Balances, transfers, etc.)钱包服务(余额、转账等)
  • Trading service (Orders, favorite pairs, etc.)交易服务(订单、喜欢的货币对等)
  • Matching service (Matching buyers and sellers)匹配服务(匹配买卖双方)
  • Live Data Service (Tickers, open positions, etc.)实时数据服务(代码、未平仓头寸等)

These are the most important parts of the system.这些是系统中最重要的部分。 How can we call this architecture?我们如何称呼这种架构? Microservices or SOA?微服务还是 SOA? Because all of these parts can be named as a microservice or service.因为所有这些部分都可以命名为微服务或服务。

Is the difference between microservices and SOA just about the communication between these or about the sharing same database or having its own data?微服务和 SOA 之间的区别仅仅是它们之间的通信,还是共享相同的数据库或拥有自己的数据?

Indeed in first glance these 2 approaches sound very similar, but when you look into it, there are a few key differences, mostly in terms of the services' scope - in microservices the services are very granular, each one of them has a single purpose.确实,乍一看这两种方法听起来非常相似,但是当你仔细研究它时,有一些关键的区别,主要是在服务的 scope 方面——在微服务中,服务非常精细,每个都有一个目的. In contrast, in SOA the granularity of the services can vary.相反,在 SOA 中,服务的粒度可以变化。

Of course there are more differences, I'd recommend to read this article in DZone (which I recommend in general for architecture topics).当然还有更多的不同,我建议在 DZone 中阅读这篇文章(我一般建议将其用于架构主题)。

The long and short of it is that it doesn't matter总而言之,它并不重要

the point is you want/need to build the business as composition of autonomous (as possible) components.关键是您希望/需要将业务构建为自治(尽可能)组件的组合。 You also want to have clear boundaries so you won't get a knot of a distributed monolith on one end and a micro-services-death-star filled with nano-services on the other.您还希望有明确的界限,这样您就不会在一端得到一个分布式单体的,而在另一端得到一个充满纳米服务的微服务死亡之星。

Personally I'd like to distinguish between service where the logical boundaries exists and reasons to build separate executables that are actually just different aspects of a service (but maybe have different scale requirements).就个人而言,我想区分存在逻辑边界的服务和构建单独的可执行文件的原因,这些可执行文件实际上只是服务的不同方面(但可能具有不同的规模要求)。 You can see for example, how netflix went this way in their third generation of architecture例如,您可以看到netflix 如何在他们的第三代架构中采用这种方式

but in any event the point is to provide agility and speed in answering changing business requirements.但无论如何,关键是提供敏捷性和速度来响应不断变化的业务需求。 the service/micro-service principles are there to help you build the components better and the exact naming is a much lower concern.服务/微服务原则可以帮助您更好地构建组件,并且确切的命名是一个低得多的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM