title: Poor performance of NServiceBus over MSMQ
body: <p>We are trying to integrate NServiceBus/MSMQ in our current web application (REST).</p>
  
  <p>Running the profiler, it seems that a <strong>lot</strong> of time is spent sending the message to the queue (see  the profiler screen shot <a href="https://i.stack.imgur.com/kHMW4.png" rel="nofollow noreferrer">1</a>, were the highlighted 30 is 30% of the overall execution time). It takes about twice the time just to send the message to MSMQ than saving an entire new set of documents in Mongo (running on a remote server).</p>
  
  <p>Is it normal that sending a message to MSMQ queue is that slow or are we missing some configuration tweak?</p>
  
  <p>The following is our current bus configuration (based on NServiceBus documentation - <a href="http://support.nservicebus.com/customer/portal/articles/894008-using-nservicebus-with-asp-net-mvc" rel="nofollow noreferrer">http://support.nservicebus.com/customer/portal/articles/894008-using-nservicebus-with-asp-net-mvc</a>):</p>
  
  <pre><code>// NServiceBus configuration
  Configure
      .WithWeb()
      .CastleWindsorBuilder(_container)
      .JsonSerializer()
      .Log4Net()
      .MsmqTransport()
      .IsTransactional(false)
      .PurgeOnStartup(true)
      .UnicastBus()
      .ImpersonateSender(false)
      .SendOnly();
  </code></pre>
  
  <p>and web.config:</p>
  
  <pre><code> &lt;MessageForwardingInCaseOfFaultConfig ErrorQueue="Error" /&gt;
   &lt;MsmqTransportConfig NumberOfWorkerThreads="1" MaxRetries="5" /&gt;
   &lt;UnicastBusConfig&gt;
     &lt;MessageEndpointMappings&gt;
       &lt;add Messages="Messages" Endpoint="MessageHandlers" /&gt;
     &lt;/MessageEndpointMappings&gt;
   &lt;/UnicastBusConfig&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/kHMW4.png" alt="Screenshot of ANTS profiler"></p>