Threadpool and Sockets

R

Richard

Hi All,

I don't know in which group my question needs to be posted so here i go:

I know that the socket 'begin...' methods uses the threadpool to call the
callback function but does that mean that the sockets can't handle more than
25 concurrent 'begin...' methods that complete since the threadpool only has
25 threads to process the completion?

Thanks for any insight in this.

Greetz,
Richard.
 
C

Chris Taylor

Hi,

By default the async sockets run on IO completion threads, these are
addition threads which can be created up to a default limit of 1000. So if
your worker thread pool is depleted (25 per CPU) async socket requests
continue to function. In the 2.0 framework the Socket.UseOnl;yOverlappedIO
would shift this to use the standard thread pool threads.

Hope this helps
 
C

Chris Taylor

Rereading my answer, I incorrectly stated that the UseOnlyOverlappedIO uses
the standard thread pool threads, that is incorrect, the IO threads are
still used and do not affect the standard 25 per cpu thread pool threads. It
is just that overlapped IO is used rather than binding a IOCompletion port
to the socket and has nothing to do with the thread management.

Dull moment, Sorry for any confusion.
 
W

William Stacey [MVP]

Also, it is not expected that many IOs will complete at ~exactly the same
point. Even so, we still should not do much in the callback, maybe just
update some state and kick off another async io (to keep the IOCP TP from
stalling).

--
William Stacey [MVP]

| Rereading my answer, I incorrectly stated that the UseOnlyOverlappedIO
uses
| the standard thread pool threads, that is incorrect, the IO threads are
| still used and do not affect the standard 25 per cpu thread pool threads.
It
| is just that overlapped IO is used rather than binding a IOCompletion port
| to the socket and has nothing to do with the thread management.
|
| Dull moment, Sorry for any confusion.
|
| --
| Chris Taylor
| http://dotnetjunkies.com/weblog/chris.taylor
| | > Hi,
| >
| > By default the async sockets run on IO completion threads, these are
| > addition threads which can be created up to a default limit of 1000. So
if
| > your worker thread pool is depleted (25 per CPU) async socket requests
| > continue to function. In the 2.0 framework the
Socket.UseOnl;yOverlappedIO
| > would shift this to use the standard thread pool threads.
| >
| > Hope this helps
| >
| > --
| > Chris Taylor
| > http://dotnetjunkies.com/weblog/chris.taylor
| > | >> Hi All,
| >>
| >> I don't know in which group my question needs to be posted so here i
go:
| >>
| >> I know that the socket 'begin...' methods uses the threadpool to call
the
| >> callback function but does that mean that the sockets can't handle more
| >> than 25 concurrent 'begin...' methods that complete since the
threadpool
| >> only has 25 threads to process the completion?
| >>
| >> Thanks for any insight in this.
| >>
| >> Greetz,
| >> Richard.
| >>
| >
| >
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top