We have an ongoing problem with message writes to MSMQ being very slow. Our queue is on Win开发者_JAVA技巧dows Server 2008 SP2. The queue is a public queue, addressed at "servername\queuename".
The code to send a message to the queue is
MessageQueue queue = new MessageQueue(Settings.Default.DefaultDestinationQueue);
queue.Formatter = new BinaryMessageFormatter();
queue.Send(message);
The message that we're trying to send is simply a "PublishMessage", as follows:
[Serializable]
public class PublishMessage {
public int EntryId {get; set; }
}
We're seeing the messages actually reach the queue, but logging before and after shows that it's generally taking in excess of 1 minute for each message.
At this time, we can't see anything wrong with our queue configuration, but are not queuing experts--this is the first addition to this application. Anyone have any ideas?
Edit: Our server is running SP 2 (not SP1 that I originally stated). Running an instance directly on the machine hosting the queue is fast, any other is not.
Note: Crossposted this at https://serverfault.com/questions/272242/msmq-write-taking-1-minute
Our problem turned out to be an infrastructure issue with servers not properly authenticating. Our sysadmin finally got it straightened out by reconfiguring the server hosting the queue.
Is the queue transactional or non-transactional? Try toggling this setting and see if you get the same behavior.
How much space is allocated for the queue? Try increasing the space, and/or moving its storage to a different drive (on a different physical spindle).
Are there messages in the system queues? Check the system queues for messages. Also, try purging all the messages from the system queues and re-run.
精彩评论