views:

33

answers:

1

I am having a performance sensitive .net application.

It is capable of doing parallel threading upto 32 threads. We have need of improving it even further. Increasing the thread may not really help since the number of failure attempts to process increases as we increase the number of threads.

My question here is,

  1. What are the options leftover to improve the performance?

  2. Would there be any possible improvement if I do run two instances of the same application each running 32 threads in parellel? Its just a wild idea considering that each application is going to be run in different AppDomains.

+3  A: 

Your best bet is to measure performance rigorously and identify bottleneck(s) before you make any more change. Throwing extra threads or processes at the problem is unlikely to result in the best solution. Start here for extensive .Net profiler information.

Why is 32 threads a magic number? Does that give you better throughput than 31/30/29 etc?

What are those threads doing when they are not working? No more threads can be active at any given time than the number of processor cores in your system. If you are CPU-bound then adding more threads is counter-productive.

How much context switching overhead is involved?

What are your external bottleneck candidates - direct I/O, network, database? You have not yet said very much about what the app actually does.

Do your threads share resources? A single shared data item can be a significant bottleneck and again, adding threads does not help in this case. Replace shared data by thread-local if possible.

Steve Townsend
The bottleneck is on the WCF Service the application calls. The service inturn has to talk to SQL server for getting results.
SaravananArumugam
Sounds like the bottleneck is in the service and/or database and if so, you can't do much on your end (unless you also own that part of the system). If it's a slow DB, can the service cache all or part of the data to avoid DB access on every call? Also - can you change to call the service in async mode? You should be able to get similar performance with less threads if so.
Steve Townsend