是否需要使用尽可能少的队列以及用于Web消息传递的解决方案 [英] Is it necessary to use as few queues as possible And solutions for web messaging

查看:91
本文介绍了是否需要使用尽可能少的队列以及用于Web消息传递的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在论坛上读到,在使用AMQP实施任何应用程序时,必须使用更少的队列.因此,如果我要克隆Twitter,我将为每个注册用户提供一个唯一且持久的队列,那我完全错误吗?似乎是最自然的方法,如果没有为每个用户分配一个唯一的队列,那么如何设计这样的东西.

I read in forum that while implementing any application using AMQP it is necessary to use fewer queues. So would I be completely wrong to assume that if I were cloning twitter I would have a unique and durable queue for each user signing up? It just seems the most natural approach and if not assign a unique queue for each user how would one design something like that.

什么是最常用的Web消息传递方法.我看到RabbitHUb和Rabbit WebHooks,但是Webhooks似乎不是可扩展的解决方案.我正在使用作为守护程序运行的Rails和我的AMQP服务器.

What is the most used approach for web messaging. I see RabbitHUb and Rabbit WebHooks but Webhooks doesn't seem to be a scalable solution. i am working with Rails and my AMQP server as running as a Daemon.

推荐答案

在RabbitMQ中,队列非常便宜.它们实际上是轻量级的Erlang进程,您可以在一台商用机器(即我的笔记本电脑)上运行数以万计的队列.当然,每个队列都会消耗一点RAM,但是最近未使用的队列将

In RabbitMQ, queues are quite cheap. They're effectively lightweight Erlang processes, and you can run tens to hundreds of thousands of queues on a single commodity machine (i.e. my laptop). Of course, each will consume a bit of RAM, but unused-recently queues will hibernate, so they'll consume as little memory as possible. In addition, if Rabbit runs low on memory for messages, it will page old messages to disk.

以上内容仅适用于单台机器. RabbitMQ支持轻量级群集的形式.当您将几个Rabbit节点加入集群时,每个节点都可以看到队列并在其他节点上进行交换,但是每个节点只能运行自己的队列.因此,您将可以拥有更多的队列! (以Erlang群集为限,通常是几百个节点),因此,群集形成了分布在多台计算机上的逻辑代理;客户端连接到它并通过任何节点透明地使用它.

The above only applies to a single machine. RabbitMQ supports a form of lightweight clustering. When you join several Rabbit nodes into a cluster, each can see the queues and exchanges on the other nodes but each runs only its own queues. So, you'll be able to have even more queues! (to the limit of Erlang clusters, which is usually a few hundred nodes) So, a cluster forms a logical broker distributed over several machines; clients connect to it and use it transparently through any of the nodes.

也就是说,每个用户只有一个持久队列似乎有些奇怪:在AMQP中,您无法在队列中浏览消息.您只能获取/使用使消息脱离队列并发布的消息(将消息添加到队列的末尾).因此,您可以将AMQP用作消息路由器,但不能将其用作某种消息数据库.

That said, having a single durable queue for each user seems a bit strange: in AMQP, you cannot browse messages while they're on the queue; you may only get/consume messages which takes them off the queue and publish which adds the to the end of the queue. So, you can use AMQP as a message router, but you can't use it as a sort of message database.

这篇关于是否需要使用尽可能少的队列以及用于Web消息传递的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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