微服务、amqp 和服务注册/发现 [英] Microservice, amqp and service registry / discovery

查看:22
本文介绍了微服务、amqp 和服务注册/发现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究微服务架构,实际上我在想一些事情.

I m studying Microservices architecture and I m actually wondering something.

我非常同意使用(返回)服务发现来使请求能够在基于 REST 的微服务上进行.我需要知道发出请求的服务(或至少是服务器集群的前端)在哪里.因此,在这种情况下能够发现 ip:port 是有意义的.

I m quite okay with the fact of using (back) service discovery to make request able on REST based microservices. I need to know where's the service (or at least the front of the server cluster) to make requests. So it make sense to be able to discover an ip:port in that case.

但我想知道在处理 AMQP(仅基于,没有 HTTP 可能调用)时使用服务注册/发现的目的是什么?

But I was wondering what could be the aim of using service registry / discovery when dealing with AMQP (based only, without HTTP possible calls) ?

我的意思是,使用 AMQP 就像我需要那个,我希望有人回答我",我不必知道向我发回响应的服务器是谁.

I mean, using AMQP is just like "I need that, and I expect somebody to answer me", I dont have to know who's the server that sent me back the response.

那么在基于 AMQP 的微服务中使用服务注册/发现的目的是什么?

So what is the aim of using service registry / discovery with AMQP based microservice ?

感谢您的帮助

推荐答案

AMQP(实际上是任何 MOM)为进程提供了一种通信方式,而无需考虑实际的 IP 地址、通信安全、路由等问题.这并不一定意味着任何进程都可以信任或什至拥有与其通信的进程有关的任何信息.

AMQP (any MOM, actually) provides a way for processes to communicate without having to mind about actual IP addresses, communication security, routing, among other concerns. That does not necessarily means that any process can trust or even has any information about the processes it communicates with.

消息队列确实解决了一半的过程:如何到达远程服务.但他们没有解决另一半:哪种服务适合我.换句话说,哪个服务:

Message queues do solve half of the process: how to reach the remote service. But they do not solve the other half: which service is the right one for me. In other words, which service:

  • 有我需要的资源
  • 可以信任(托管在可靠的服务器上,具有令人满意的服务实施,位于当地法律符合您要求的国家/地区等)
  • 收取您想支付的费用(尽管人们很少讨论微服务的成本)
  • 将在处理您的服务所需的整个时间窗口内都在那里——请记住,服务器变得越来越不稳定.有些服务器实际上是可以持续几分钟的容器.

这两个问题几乎是线性无关的.为了解决第二类问题,您需要在网格计算中使用资源代理.还有资源分配,以确保正确管理上述最后一项.

Those two problems are almost linearly independent. To solve the second kind of problems, you have resource brokers in Grid computing. There is also resource allocation in order to make sure that the last item above is correctly managed.

有一些替代策略,例如多播使用服务的意图并等待报价的回复.例如,您可能会在这种情况下进行反向拍卖.

There are some alternative strategies such as multicasting the intention to use a service and waiting for replies with offers. You may have reverse auction in such a case, for instance.

简而言之,经验法则是,如果您对要使用的服务(硬编码或在某些配置文件中)没有先验知识,则您的代理将必须进行协商,其中包括动态服务发现.

In short, the rule of thumb is that if you do not have an a priori knowledge about which service you are going to use (hardcoded or in some configuration file), your agent will have to negotiate, which includes dynamic service discovery.

这篇关于微服务、amqp 和服务注册/发现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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