Increase the wcf web service performance with sepa

2019-09-14 01:59发布

问题:

I’m new in .net and it’s really hard to me explain my problem. So if you think I didn’t provide enough information or anything else, feel free and tell me.

I have a web service for sending the text message. I receive an array of messages in input then send them. In the background, I have the queue. I put each message in the queue then send it. I treat them like a task. Each task has a maximum try count, timeout and ... Sometimes I have to try many times in order to send a single message. This Couse great overhead in my server. (In average I try about 10 million times in a day and I only send about 6 million messages successfully.)

But sometimes my web service users receive the timeout. I increase the IIS queue length to maximum and set the maximum worker process to 0. But the problem didn’t solve. Finally, I separate the project in two. One as an interface. Users call this interface and I put them in the queue. And another one just for the tasks. It does the queue tasks. Then problem solved. 1- I didn’t change the server resources. 2- I didn’t change the code logic(I just convert it to two projects) Then my web service stops returning timeout error.

Here is my question: can I do it without separating the projects? Do I miss something in IIS configure?

UPDATE:

  1. my web service application hosted in IIS 8 and I use the WCF technology.
  2. I increase the max connections to 1000, maxConcurrentCalls, maxConcurrentSessions, maxConcurrentInstances, and max iis workers to thing got little better but in compare to separate projects it's not good at all.
  3. I close the client in all my projects.
  4. here is part of my web config:

      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="2147483647" maxConcurrentInstances="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    
    <connectionManagement>
      <add address="*" maxconnection="1000" />
    </connectionManagement>
    
标签: c# rest iis web iis-8