Peter Kirk wrote:
"Richard Blewett [DevelopMentor]" <ri******@NOSPAMdevelop.com> skrev
i en meddelelse news:uD****************@tk2msftngp13.phx.gbl... The one question really is what are these thread pool threads doing?
The threadpool is really for relatively short lived work - if you are
exhausting the thread pool you must be generating alot of threadpool
work or the each work item must be taking a while to execute.
I have a lot of work to do. I have to execute about 10000 queries
against a search engine, each of which will take a long time (15
seconds to 5 minutes) to complete.
I wanted to put these into some threads to try to help throughput.
Obviously 10000 threads is too much - but what is good? I though 25
threads sounded too little. I must admit that I haven't actually
tested anything yet because there is no real data yet to work on - I
know one shouldn't "optimise" too early, and maybe the search engine
won't handle a large number of simultaneous requests anyway... so
maybe I need to wait, just wanted to keep ahead.
The built in Thread Pool is not the solution to your problem. It's designed
for short, high CPU, low I/O operations. Your requirements are long, low
CPU, high I/O operations.
I see 2 alternatives:
1. Build your own thread pool which will balance things to your needs.
This can be quite challenging.
2. Use Asynchronous I/O. This is likely the optimal way to go. You could
use the build in Thread Pool to handle the return information from the Async
I/O... that'd probably work fairly well.
By the way, it's entirely possible to overwhelm the target system with a
huge number of outstanding requests. You'll want to be careful about that,
I would expect.
--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]