libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Using MHD_USE_INTERNAL_POLLING_THREAD without MHD_OP


From: Evgeny Grin
Subject: Re: [libmicrohttpd] Using MHD_USE_INTERNAL_POLLING_THREAD without MHD_OPTION_THREAD_POOL_SIZE
Date: Wed, 07 Aug 2019 01:10:13 +0300

Hi Nicolas,
 
You should provide pool size with MHD_OPTION_THREAD_POOL_SIZE only if you are not using "thread per connection".
"Thread pool" mode handle all connections by specified number of threads.
"Thread per connection" run one thread for watching for new incoming connection and separate thread for each connection. "Thread per connection" is less efficient as it may try to run more threads than number of available logical CPU cores, but allow to implement response callbacks in lazy way, when callback may block processing for a long period of time.
In "thread pool" (and "Internal polling thread") modes response callbacks must not block. If you need noticeable amount of time to generate a response, you should suspend connection and resume it when response is ready.
 
-- 
Best Wishes,
Evgeny Grin
 
 
 
06.08.2019, 20:04, "Nicolas Mora" <address@hidden>:

When using the flag MHD_USE_THREAD_PER_CONNECTION with MHD_start_daemon,
MHD recommends to explicitly enable flag MHD_USE_INTERNAL_POLLING_THREAD
too.

Is there a default thread pool size if we don't use the flag
MHD_OPTION_THREAD_POOL_SIZE? Should we set it to an arbitrary value? Or
should I assume MHD will provide the right pool size according to the
system it's running on?
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]