如何增加 MSMQ 中可存储的消息数量
我们的系统中有许多 MSMQ 队列,包括私有队列和公共队列。有时,从队列读取的 Windows 服务会崩溃,因此消息会在该队列中堆积。一旦队列达到一定大小(可能是 60K 消息),该服务器上的所有队列将停止工作,并抛出有关资源不足的错误。
我的问题是,队列在幕后是如何真正工作的,它们是将消息存储在 RAM 中还是硬盘上?当服务器内存不足时,它是否会耗尽资源并崩溃?如果它使用硬盘驱动器上的一些分配空间,有没有办法增加允许的大小?如果使用 RAM,我可以简单地向服务器添加 RAM,然后增加允许的大小吗?
我需要确保当服务出现故障时,我们可以在修复服务的同时在该队列中存储 100K 或 200K 消息,因为这些消息对我们的业务至关重要。
We have a number of MSMQ queues throughout our system, both private and public queues. Sometimes a windows service that reads from a queue will crash, and so messages will build up in that queue. Once the queue gets to a certain size (maybe 60K messages), all queues on that server will stop working, throwing errors about insufficient resources.
My question is, how are the queues really working behind the scenes, are they storing messages in RAM or on the hard drive? Does it run out of resources and crash when the server runs out of RAM? If it's using some allocated space on the hard drive, is there a way to increase the allowable size? If it's using RAM, can I simply add RAM to the servers and then that will increase the allowable size?
I need to make sure that when a service goes down, we can handle storing 100K or 200K messages in that queue while we work on fixing the service, as those messages are critical to our business.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 MSDN 上的一篇文章,似乎解决了您的问题(正如 John 在下面指出的那样,这仅适用于 Windows Server 2000,因此大多数人可能会忽略): MSMQ 应用程序中的资源管理。具体来说:
编辑:调整链接似乎已损坏。我相信它应该指向此处。
对于 MSMQ 的更高版本,John 在 一篇博客文章。
Here is an article on MSDN that seems to address your question (as John points out below, this only applies to Windows Server 2000 so should probably be ignored by most people): Resource management in MSMQ applications. Specifically:
Edit: the tuning link seems to be broken. I believe it should be pointing here.
In terms of later versions of MSMQ, John discusses the issue in a blog post.
不确定深入的答案,但无论如何,从表面上看,非事务性队列将消息存储在内存中,而事务性队列将消息存储在磁盘上。
更新
正如 John 在下面所述,无论使用持久队列还是非持久队列,所有消息都保存在磁盘上。
Not sure about the in-depth answer, but on a surface level anyhow, a non-transactional queue stores messages in memory, whereas a transactional queue stores messages on disk.
UPDATE
As John states below, all messages are held on disk whether durable or non-durable queues are used.