gpt4 book ai didi

msmq - 如何增加可存储在 MSMQ 中的消息数量

转载 作者:行者123 更新时间:2023-12-02 02:21:15 26 4
gpt4 key购买 nike

我们的系统中有许多 MSMQ 队列,包括私有(private)队列和公共(public)队列。有时,从队列中读取的 Windows 服务会崩溃,因此消息会在该队列中堆积。一旦队列达到一定大小(可能是 60K 条消息),该服务器上的所有队列都将停止工作,并抛出有关资源不足的错误。

我的问题是,队列在幕后究竟是如何工作的,它们是将消息存储在 RAM 中还是硬盘驱动器上?当服务器用完 RAM 时,它会用完资源并崩溃吗?如果它在硬盘驱动器上使用一些分配的空间,有没有办法增加允许的大小?如果它使用 RAM,我是否可以简单地向服务器添加 RAM,然后这将增加允许的大小?

我需要确保当服务出现故障时,我们可以在修复服务的同时在该队列中存储 100K 或 200K 条消息,因为这些消息对我们的业务至关重要。

最佳答案

MSDN 上的一篇文章似乎解决了您的问题(正如约翰在下面指出的,这仅适用于 Windows Server 2000,因此大多数人可能会忽略):Resource management in MSMQ applications .具体来说:

For MSMQ 1.0 and MSMQ 2.0, the combined size of messages capable of being stored on one machine is not limited to the amount of RAM in the machine or the size of the hard disk, but to the amount of virtual address space provided to the MSMQ service by the operating system (this limitation has been lifted in MSMQ 3.0). Each process in an x86 machine is allotted a virtual 4 GB of addressable memory. 2GB is reserved for use in kernel mode and 2GB for user mode. The MSMQ Queue Manager operates in user mode and therefore has an addressable 2GB of virtual address space to work with. Each message's data is stored in RAM, which is backed up by the system's paging file or memory mapped files. MSMQ uses memory mapped files to store both express and recoverable messages. Since we are limited to 2GB of addressable memory, we are limited to 2GB worth of messages on a disk. When you take into account the memory utilized by MSMQ code and its internal data structures, as well as file allocation to store message files on disk, we end up with between 1.4GB and 1.6GB worth of messages that can be stored on disk.

Note   This limitation of 1.6GB can be raised to approximately 2.6GB by enabling 3GB tuning on the MSMQ Service. See Q171793 for more information on how to enable 3GB tuning.

编辑:调整链接似乎已损坏。我相信它应该指向here .

关于更高版本的 MSMQ,John 在 a blog post 中讨论了该问题.

Maximum number of messages

This one is not as simple to work out. From my Insufficient Resources post we know that each message needs 75 bytes of kernel memory for indexing so, for example, 2 million messsages would require roughly 150 megabytes. It would seem, therefore, that all you need to do is add more RAM. After looking at a comparison of 32-bit and 64-bit memory architectures, though, you will quickly have to move to the 64-bit platform to take advantage of your investment as 32-bit machines max out at 450 MB of paged pool memory regardless of the amount of RAM fitted.

But, again, if you are trying to work out what amount of RAM will generate the paged pool memory required to accommodate a billion MSMQ messages, your design spec is up for some serious reviewing.

关于msmq - 如何增加可存储在 MSMQ 中的消息数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8070717/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com