Gruenke, Matt
2013-06-14 19:27:19 UTC
BTW, that's also assuming there are enough threads to handle all
connected client & incoming requests. Obviously, this design is not
going to scale well, but that's not my point.
I'm trying to ask a narrow question about whether this is simply generic
advice about good server design, or whether it comes from knowledge of
anything in the implementation of ASIO, whereby long-running completion
handlers would actually block anything else.
I thought the whole point of io_services supporting multiple threads was
to allow completion handlers to execute in parallel, in which case I'd
expect one not to block anything else.
Matt
-----Original Message-----
From: Gruenke, Matt [mailto:***@Tycoint.com]
Sent: June 14, 2013 15:05
To: asio-***@lists.sourceforge.net
Subject: Re: [asio-users] Async HTTP and requests requiring long
processingtime
Can anyone explain why? Are there any locks held while executing
completion handlers? Or does this advice originate purely from a
standpoint of not wanting to let the connection go idle?
Matt
-----Original Message-----
From: Green, Cliff [mailto:***@boeing.com]
Sent: June 14, 2013 13:47
To: asio-***@lists.sourceforge.net
Subject: Re: [asio-users] Async HTTP and requests requiring long
processing time
As Guilherme has already recommended, queuing the work to another thread
is the way to go. This is a general recommendation for Asio design - if
a handler is going to take a "long" time to complete, pass the work off
to something else. I generally do all network event processing in one
thread - i.e. all Asio related work is in a single thread (which
simplifies a lot of issues), and if functionality is needed that is
compute or IO intensive, that work is passed to another thread (which
knows nothing about network / Asio). Sometimes the design can get a bit
complicated when dealing with "transactional" type network requests, but
there are straightforward solutions.
Cliff
------------------------------------------------------------------------
------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
asio-users mailing list
asio-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
connected client & incoming requests. Obviously, this design is not
going to scale well, but that's not my point.
I'm trying to ask a narrow question about whether this is simply generic
advice about good server design, or whether it comes from knowledge of
anything in the implementation of ASIO, whereby long-running completion
handlers would actually block anything else.
I thought the whole point of io_services supporting multiple threads was
to allow completion handlers to execute in parallel, in which case I'd
expect one not to block anything else.
Matt
-----Original Message-----
From: Gruenke, Matt [mailto:***@Tycoint.com]
Sent: June 14, 2013 15:05
To: asio-***@lists.sourceforge.net
Subject: Re: [asio-users] Async HTTP and requests requiring long
processingtime
Can anyone explain why? Are there any locks held while executing
completion handlers? Or does this advice originate purely from a
standpoint of not wanting to let the connection go idle?
Matt
-----Original Message-----
From: Green, Cliff [mailto:***@boeing.com]
Sent: June 14, 2013 13:47
To: asio-***@lists.sourceforge.net
Subject: Re: [asio-users] Async HTTP and requests requiring long
processing time
... Recently we added a new feature that requires a long processing
time like 10 minutes.As Guilherme has already recommended, queuing the work to another thread
is the way to go. This is a general recommendation for Asio design - if
a handler is going to take a "long" time to complete, pass the work off
to something else. I generally do all network event processing in one
thread - i.e. all Asio related work is in a single thread (which
simplifies a lot of issues), and if functionality is needed that is
compute or IO intensive, that work is passed to another thread (which
knows nothing about network / Asio). Sometimes the design can get a bit
complicated when dealing with "transactional" type network requests, but
there are straightforward solutions.
Cliff
------------------------------------------------------------------------
------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
asio-users mailing list
asio-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio