I have created a simple WCF service with a method Do work, which sleeps for 15 seconds and then return a string. Its a Singleton service with multiple Concurrency.
The client(.net Desktop Application) has a for loop of 100 to call this function. I want to see how many threads i can process at one time and increase performance.
I am using NetTCP binding and have added the performance parameters
Server config
<services>
<service name="WCFService.WCFService" behaviorConfiguration="mexbahaviour">
<endpoint address="WCFService" binding="netTcpBinding" contract="WCFService.IWCFService" ></endpoint>
<endpoint address="WCFService" binding="netNamedPipeBinding" contract="WCFService.IWCFService" ></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8090/ "/>
<add baseAddress="net.tcp://localhost:8091/ "/>
<add baseAddress="net.pipe://localhost/ "/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexbahaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceThrottling maxConcurrentCalls="300" maxConcurrentSessions="300"
maxConcurrentInstances="600" />
</behavior>
</serviceBehaviors>
</behaviors>
The issue is the that the request is not hitting the server fast enough. Initial sec there are 4 request, but after that there are 2 requests per seconds. The output window on service looks like this.
So in this a new thread is created whenever a requests hit the service and logs the time it was received and the goes to sleep.
I did Add connection Management section on the client side
<connectionManagement>
<add address="*" maxconnection="100"/>
</connectionManagement>
Is the delay due to thread creation? or some service-throttling limitation that i am hitting?
Please Give suggestions what i do.
I also tried to implement using this article which helped Boost WCF Performance
I think, this is based on a basic policy of thread pool. You can modify minThreads as follows,
int worker, int io;
ThreadPool.GetMinThreads(out worker, out io);
ThreadPool.SetMinThreads(worker, 100 - io); // 100 is just sample value.