How can we speed up receiving messages from MSMQ?

My bottleneck application began to send and receive messages through MSMQ using MassTransit. Sending and receiving occurs in one application, but often there are too many messages to use the queue in memory.

Here is my simple queue setup:

messageBus = ServiceBusFactory.New(sbc => { sbc.UseMsmq(); sbc.VerifyMsmqConfiguration(); sbc.UseMulticastSubscriptionClient(); sbc.ReceiveFrom("msmq://localhost/msg_queue"); sbc.Subscribe(subs => { subs.Handler<EventMessage>(msg => Enqueue(msg)); }); }); 

In my experiments, MSMQ currently has ~ 1 million messages, and we do not click on it with any new messages. We do no work in Enqueue() except how fast messages are sent.

With this information, we can only receive from 150 to 200 messages per second from MSMQ when I was hoping it would be at least 1000 messages per second when there is no network latency. Each message is <2kb.

How can we speed up how quickly MSMQ transfers messages to the application through MassTransit while keeping the message ordering in the queue?

+7
c # message-queue msmq masstransit
source share
1 answer

I used to turn to something similar. If I remember him correctly, We indicated the expiration of the message through TimeToBeReceived (the total time the message was sent from the target queue. InfiniteTimeout is used by default.). See the msdn link.

+1
source share

All Articles