Re: Asynchronous socket operations and threadpool
- From: "William Stacey [MVP]" <william.stacey@xxxxxxxxx>
- Date: Mon, 6 Mar 2006 21:51:38 -0500
| The wait is on a WaitHandle for an operation performed during a callback.
| For example, you get a big chunk of data for the user (via the async call)
| and realize you need to perform a database lookup to satisfy the request.
| You kick off the DB Request async, do as much more of the user request as
| you can, then wait for the DB Request to complete. Once it's done, you
send
| the user back his data, and put the socket back into BeginRead.
Thanks. I see what your doing. However, the waitHandle really turns you back
into a blocking server instead of an async. If db requests will be handled
by every client, this could starve the IOCP TP pretty fast as you said in
other posts. Why not do the db lookup async and in the callback do the
beginwrite back to the client. All state driven, and a pain, but no
blocking threads on IO. That said, you pointed out some potential issues
that could be very hard to diag with using a lot of async. So maybe the
pipe-line server deserves another look.
| One thing I'm not clear on, given what you describe - when you get data
from
| a socket, and realize you have something significant to do (and you want
to
| do it async), how do you do it? You can't just post it to the ThreadPool,
as
| there aren't enough threads in there. You don't want to manage a ton of
| threads manually if you can help it...
Just update your state and kick off another async like above then do the
next "thing" in the callback (i.e. write to client, next stage, etc).
Cheers Chris.
--wjs
.
- References:
- Asynchronous socket operations and threadpool
- From: Yifan Li
- Re: Asynchronous socket operations and threadpool
- From: Chris Mullins
- Re: Asynchronous socket operations and threadpool
- From: William Stacey [MVP]
- Re: Asynchronous socket operations and threadpool
- From: Chris Mullins
- Re: Asynchronous socket operations and threadpool
- From: William Stacey [MVP]
- Re: Asynchronous socket operations and threadpool
- From: Chris Mullins
- Asynchronous socket operations and threadpool
- Prev by Date: RE: LoadFrom() and probing paths
- Next by Date: Index aspx files in a restricted ( shared server) enviroment
- Previous by thread: Re: Asynchronous socket operations and threadpool
- Next by thread: Re: Bug in TableLayoutPanel
- Index(es):
Relevant Pages
|