Domanda

I have the following code, which is not that slow, and also not that fast. Is there anyway to improve this? I currently get 1000 messages in like 5 to 10 seconds, which isn't ideal yet in my opinion.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <netMsmqBinding>
        <binding name="NetMsmqBinding_IProductService"
                 deadLetterQueue="System"
                 maxReceivedMessageSize="524288">
          <readerQuotas maxDepth="32"
                        maxStringContentLength="524288"
                        maxBytesPerRead="524288"/>
          <security mode="None"/>
        </binding>
      </netMsmqBinding>
    </bindings>
    <client>
      <endpoint address="net.msmq://localhost/private/Products" binding="netMsmqBinding"
        bindingConfiguration="NetMsmqBinding_IProductService" contract="Products.IProductService"
        name="NetMsmqBinding_IProductService" />
    </client>
  </system.serviceModel>
</configuration>

Processor not related answers please, I mean configuration-wise how to make it faster

È stato utile?

Soluzione

With .net 4.5 you could use compression, but that would require completely rewriting you binding from the bottom up.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="CompressedNetMsmqBinding_IProductService"
                 >

          <binaryMessageEncoding compressionFormat="GZip" >
            <readerQuotas maxDepth="32"
                          maxStringContentLength="524288"
                          maxBytesPerRead="524288"/>
          </binaryMessageEncoding>
          <msmqTransport
                 deadLetterQueue="System"
                 maxReceivedMessageSize="524288"/>
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="net.msmq://localhost/private/Products" binding="netMsmqBinding"
        bindingConfiguration="NetMsmqBinding_IProductService" contract="Products.IProductService"
        name="CompressedNetMsmqBinding_IProductService" />
    </client>
  </system.serviceModel>
</configuration>

Altri suggerimenti

If performance is the only thing that you are looking for and are willing to sacrifice persistence then I would advise that you investigate non-transactional memory queues. They have no transaction overhead, and since they are not serialized to disk they are quite fast. You will still have to deal with network latency however if you are in a distributed environment.

Hope this helps,

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top