On 02/01/2013 11:32 AM, David J Myers wrote:
My server must stream to a number of concurrent clients. Does that not
therefore mean that I need a multi-threaded mode, not the single-threaded
external-select mode?
External-select can handle up to 1k concurrent clients.
If I use the thread-per_connection mode, what is the consequence of
returning zero from the callback instead of blocking? Does it create a new
thread for the next callback?
No, MHD will just call the callback instantly again.
If I use the thread-pool mode, I can't return zero from the callback, but
what would be the consequence of blocking in this mode? This is my preferred
mode.
In thread-pool mode, blocking would cause all other connections that are processed by the same thread to stall. So that's the worst kind of behavior as the other connections might have data ready. Thus, the thread pool mode must only be used if the callbacks are "virtually non-blocking" (by "virtually", I mean to say that I'd not necessarily count disk IO operations in this). Note that *all* modes can support concurrent clients; the only fundamental limitation (with respect to performance) of the select/poll modes is that they only use a single core.


Happy hacking!

Christian

Reply via email to