在中等流量网站上实现消息队列的最佳方式是什么
首先,关于我的项目的一些基本信息:我有一个每天约有 1000 名访问者的网站,使用 Symfony 2 构建。对于我正在考虑实现消息队列的某些任务,基于一些互联网,Rabbit MQ 将是我的首选评论。
但我认为我将有很多不同的任务类型(在第一阶段大约有 10 个任务),而且它们不会运行那么多。例如:我想要一个用于发送电子邮件的消息队列:我希望这些邮件立即发送,因此创建 cron 作业实际上不太可接受,但我的网站可能每天发送 5 封电子邮件。
现在我想知道是否为每种任务类型创建消息队列更好。在这种情况下,我将不得不运行 10 个并发消费者。或者创建一个“通用”队列,它只使用消息中的参数执行 Symfony2 命令。
我认为最好和最“纯粹”的解决方案是第一个(10个队列),但我担心这有点“过头”......
那么有没有人有这方面的经验愿意帮助我?
First off, some basic information about my project: I have a website with about 1000 visitors a day, built with Symfony 2. For some tasks I'm thinking about implementing a message queue, Rabbit MQ would be my first choice based on some internet reviews.
But I think I'm going to have a lot of different task types (in the first stage about 10 tasks), and they aren't going to be run that very much. For instance: I want a message queue for sending e-mails: I want these to be sent immediately, so creating a cron job is not really acceptable, but my website will maybe send 5 e-mails a day.
Now I'm wondering if it's better to create message queues for every task type. In which case I will have to run 10 concurrent consumers. Or create one 'generic' queue, which just executes a Symfony2 Command with the parameters in the message.
I think the best and most "pure" solution would be the first (10 queues), but I'm worried it's a bit 'overdone'...
So does anyone have any experience with this is willing to help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有同样的情况。我有兴趣建造类似的东西。
不幸的是我仍在尝试设置该项目。到目前为止,我已经度过了一天,现在我可以发送和接收消息了。我需要继续弄清楚文档所指的“服务”定义中相关的方式和内容。
当我有答案时,我一定会添加我的答案。
到目前为止,我做了什么:
添加了以下子模块
遵循 RabbitMqBundle 上的说明。
...我有一些工作,但尚未弄清楚哪些约定如何工作。
I have the same situation. I am interrested in building something similar.
Unfortunately I am still trying to setup the project. I spent the day so far and now I can send and recieve messages. I need to continue figuring out how and what is relevant in the "service" definition the documentation refers to.
When I have an answer, i'll definely add my answer.
So far, what I did:
Added the following submodules
Followed instructions on RabbitMqBundle.
... I have something working, but not yet figured out how what works by which conventions.
我建议为需要执行的每个独特任务创建不同的队列,并为队列分配优先级,以便首先执行最重要的操作,即使它们稍后与队列中的其他消息一起添加。
在队列处理器中,您可以使用消息正文作为参数来执行不同的命令。
I would recommend creating different queues for each unique task that you need to be executed, and assign priorities to the queues so that the most important actions are executed first even if they are added later on with other messages in the queue.
In your queue processor you can execute different commands using the message body as parameters.