473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Threadpool and Sockets

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.
Sep 24 '06 #1
6 1633
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
"Richard" <rh@xs4all.nlwrote in message
news:45**********************@news.xs4all.nl...
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.

Sep 24 '06 #2
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
"Chris Taylor" <ch*************@hotmail.comwrote in message
news:eb**************@TK2MSFTNGP05.phx.gbl...
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
"Richard" <rh@xs4all.nlwrote in message
news:45**********************@news.xs4all.nl...
>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.


Sep 24 '06 #3
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]

"Chris Taylor" <ch*************@hotmail.comwrote in message
news:Ol**************@TK2MSFTNGP06.phx.gbl...
| 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
| "Chris Taylor" <ch*************@hotmail.comwrote in message
| news:eb**************@TK2MSFTNGP05.phx.gbl...
| 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
| "Richard" <rh@xs4all.nlwrote in message
| news:45**********************@news.xs4all.nl...
| >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.
| >>
| >
| >
|
|
Sep 24 '06 #4
"William Stacey [MVP]" <wi************@gmail.comwrote in message
news:ul****************@TK2MSFTNGP06.phx.gbl...
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).
Also, see Chris Mullins' blog posting about scalability of .NET socket I/O:

http://www.coversant.net/dotnetnuke/...=88&EntryID=10

-cd
Sep 24 '06 #5
Thnx for your time and answers,

Richard.

"Richard" <rh@xs4all.nlschreef in bericht
news:45**********************@news.xs4all.nl...
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.

Sep 25 '06 #6
Damn! You beat me too it! :)

--
Chris Mullins, MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins
"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:uU**************@TK2MSFTNGP04.phx.gbl...
"William Stacey [MVP]" <wi************@gmail.comwrote in message
news:ul****************@TK2MSFTNGP06.phx.gbl...
>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).

Also, see Chris Mullins' blog posting about scalability of .NET socket
I/O:

http://www.coversant.net/dotnetnuke/...=88&EntryID=10

-cd


Sep 25 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dan Battagin | last post by:
Is there a known bug with the interaction between the HttpWebRequest and the ThreadPool? I current spawn several HttpWebRequest's using BeginGetResponse, and they work for a while, using worker...
5
by: Duane Pressley | last post by:
I'm looking for someone to help me make sense of the results I'm observing when using the ThreadPool class in a COM-Interop scenario. Here's the set up: 1.. A classic ASP page instantiates and calls...
1
by: doudou-shen | last post by:
I will use threadpool do some work with threadpool . but I haven't any information about it . who can help me! thank a lot
13
by: orekin | last post by:
Hi There I have been programming C# for a couple of months and am trying to master Threading. I understand that ThreadPool uses background threads (see code example in MSDN page titled...
10
by: Lenn | last post by:
Hello, I have always used a certain design pattern for multithreaded Windows app; Start new worker thread from UI thread, use events to notify UI threads when something happens, update UI...
3
by: fniles | last post by:
I am using ThreadPool to call a sub in a class. The first time the ThreadPool is called, I created a socket in the thread. I can connect a client to the socket and send a message to the client (in...
1
by: Sam | last post by:
Hi All, I'm trying to write a simple multi-threaded windows service application using ThreadPool and I'm running into the same problem as described by MS article:...
6
by: Michael D. Ober | last post by:
I have an application that needs to limit the number of simultaneous threads that are executing at any given time. The threadpool appears to be ideal for this. However, I need to have my Sub Main...
3
by: UltimateBanoffee | last post by:
Hi, I'm using asp.net 2.0 and I have an understanding issue here! I don't quite understand when the available threads in the ThreadPool are ever used. The application I have running doesn't use...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.