Updated: January 21, 2005
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
Message storage size limits, or quotas, specify the maximum cumulative storage size for all messages contained in a particular queue or on a computer. There are additional storage size limits, or quotas, that specify the maximum cumulative storage size for all journal messages contained in a particular queue journal or for messages contained in the computer journal and the dead-letter queues.
By understanding how messages are stored locally, you can determine the disk space being used to store messages, and you can inspect the properties of local queues.
The following sections discuss these concepts.
Quotas for messages
Quotas for messages can be divided into computer quotas and queue quotas. These quotas specify the cumulative size for all messages (including journal messages) contained in a particular queue or on a computer.
Computer quotas specify the cumulative limit for all messages stored in destination queues, outgoing queues, and queue journals on a computer. Computer quotas are not applied towards internal private queues. Unlike queue quotas, when a computer quota is reached, no messages can be delivered to any queue or journal on the computer. No negative acknowledgment message is generated, and an error is returned for messages sent locally, while a remote computer tries to resend until one or more messages are removed (read) from a queue on the computer. Computer quotas are set for Message Queuing servers and independent clients. Computer quotas set on Message Queuing servers that support dependent clients apply both to the server and to all its dependent clients. Computer quotas for message storage and journal storage are set separately. For instructions on setting the message storage size for a computer, see Set the message storage size for computers. For instructions on setting the journal storage size for computers, see Set the journal storage size for computers. Following a new installation of Message Queuing, or an upgrade from Windows 2000, the default limit for these storage sizes is 8 gigabytes (GB).
A queue quota specifies the cumulative storage size (number of bytes) available for all messages stored in a particular queue, whereas a computer quota limits the total storage available for all messages in destination queues, outgoing queues, and queue journals on the computer. When a queue quota is reached, messages can no longer be sent to the queue until one or more messages are retrieved (removed from the queue by a Message Queuing application). Queue quotas can be set for all queues. Queue quotas for message queues and journal queues are set separately. For instructions on setting the quotas for regular messages, see Set the message storage size for queues. For instructions on setting the storage size for the computer journal and dead-letter queues, see Set the journal storage size for queues.
Queue quotas and computer quotas can be set independently, and only on Message Queuing servers and independent clients. Message Queuing servers and independent clients can store messages only up to a certain limited maximum number on each computer, which depends on several factors. Quotas set on Message Queuing servers that support dependent clients apply both to the server and to all its dependent clients, since dependent clients do not store messages locally. Thus, a Message Queuing server supporting several dependent clients can hold no more than its own maximum number of messages divided by the number of dependent clients. For example, if the computer quota for the server is 50 megabytes (MB) and one dependent client creates 50 MB of messages, the server and the other dependent clients supported by the server cannot send messages until the total message storage size drops below that quota.
The computer quota is enforced first, regardless of the cumulative queue quotas. For example, if you specify a 10 MB quota for each of six queues on a computer and a 50 MB quota for the computer, Message Queuing enforces the 50 MB computer quota first before each queue quota is reached. However, each queue quota still prevents any one queue from storing more than 10 MB of messages.
Local message storage
The files used to store messages are located in the Msmq\Storage and Msmq\Storage\Lqs folders (under \Windows\System32 by default).
Messages are stored in memory-mapped files (.mq files) on the hard disk of the source computer, destination computer, or intermediate Message Queuing server with routing services enabled. Disk space is allocated for both express and recoverable messages in 4 MB increments as needed. For each recoverable message, the memory-mapped message file is written to disk, ensuring that the message is recoverable. For express messages, memory-mapped files are written to disk only when the computer does not have sufficient resources to hold the message in memory.
The computer sending the message creates the memory-mapped files. Message Queuing servers used to route messages also store messages in memory-mapped files. If source journaling is used, the memory-mapped files are located on the source computer. If target journaling is used, they are located on the destination computers. Message Queuing servers store all message files for the dependent clients they support.
To help safeguard your system against attacks by intruders, deleting, editing, or adding any file under the Msmq\Storage folder generates an audit entry in the security log.
The memory-mapped files can be stored using any file system supported by Windows Server 2003 family. However, because the NTFS file system for Windows Server 2003 family provides more reliable file recovery after a power failure or system crash, it is highly recommended for Message Queuing servers. In addition, it is recommended that you back up the folders where the message storage files are kept for fault tolerance. If the hard disk that contains the message files fails and if the data cannot be recovered using a backup program or the message backup/restore utility provided with Message Queuing, the messages will be lost. For more information on the message backup and restore utility, see Backing up and restoring messages.
Files in the Msmq\Storage folder
Files with an .mq extension represent memory-mapped files in which messages are stored. The .mq file name extension is prefixed with a letter representing the type of message it is currently storing, as follows:
r — Express messages (Express messages are normally stored in RAM, not on disk. This file is used when there is no more available RAM.)
p — Recoverable messages.
j — Journal messages.
l — Message logger file for interpreting recoverable and journal message files.
An .mq file does not represent one particular queue. Messages from multiple queues can be stored in one .mq file, and messages from a single queue can be stored in multiple .mq files. However, a single message cannot span multiple files. This is the reason for the 4 MB limit in message size.
The QMLog file is a history of all transactional processing. When the log is full, the oldest data are overwritten as new entries are made. To allow such continuous cyclic writing to the QMLog file, the message sequence and the state of all active transactions are periodically saved to the following files, respectively:
The MQInSeqs.* files are referred to as the message logger files, and the MQTrans.* files are referred to as the transaction logger files.
The *.lg1 and *.lg2 files are written to in an alternating pattern to ensure that one file in each pair is recoverable if the other is corrupted during a write operation.
Files in the Msmq\Storage\Lqs folder
Files in the Lqs (local queue storage) folder are text files that describe properties of the local queues.
File names with the nnnnnnnn.hhhhhhhh format represent private queues. The nnnnnnnn portion is the queue number (which is included in the direct format name of the queue). The hhhhhhhh extension is a hash of the queue path and is used for quick lookup.
File names with the aaaaaaaabbbbccccddddeeeeeeeeeeee.hhhhhhhh format represent local public queues. The left-hand 32-character portion of the file name is the globally unique identifier (GUID) of the queue. The hhhhhhhh extension is a hash of the queue path.
If you delete the files in the Lqs folder, you will destroy the internal private queues, in which messages needed for internal Message Queuing operations are stored and without which the Message Queuing service cannot start running. Check for Message Queuing events in Event Viewer. The most common symptoms of the loss of these queues are events with IDs 2020 and 2052.
The message store location must only be modified using the Storage tab, in Computer Management, Services and Applications, Message Queuing properties.