We ran out of message queuing resources on one of the servers and started seeing the following message in the event log whenever a message is being sent to message queuing.
An error occurred while sending to the queue: There are insufficient resources to perform this operation. (-1072824281, 0xc00e0027).Ensure that MSMQ is installed and running. If you are sending to a local queue, ensure the queue exists with the required access mode and authorization. –
Server stack trace:
at System.ServiceModel.Channels.MsmqOutputChannel.OnSend(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object ins, Object outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
The issue was that we had journaling turned on and one of our message queues had around 30,000 messages. We wanted to determine how message queuing allocates resources whenever it receives messages.
Based on web-search, we found that message queuing stores files on C:\Windows\System32\msmq\storage folder
We wrote a program that sends uniform-sized messages to a private queue which is processed in IIS immediately and stores it in the journal queue. We found that MSMQ allocates 4MB chunks in each file on the storage folder, each file can hold numerous messages.
We set the storage limits on the general tab of Message Queuing properties as below:
We changed the storage limits to 7800KB and ran the tests with different message-body sizes:
For message-body sizes up to around 863 bytes, the test failed at 5400 messages, implying an average allocation of 1500 bytes on disk.
For message-body of 974 bytes, the test failed at 3900 messages, implying an average allocation of 2000 bytes on disk.
For higher messages, the allocation seemed to be in 500 byte chunks.