Hi,
I have some doubts regarding how MHD_OPTION_THREAD_POOL_SIZE and
MHD_OPTION_CONNECTION_LIMIT interact together. From MHD
documentation at
https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html:
- MHD_OPTION_THREAD_POOL_SIZE: Number (unsigned int) of threads
in thread pool. Enable thread pooling by setting this value to
to something greater than 1.
- MHD_OPTION_CONNECTION_LIMIT: Maximum number of concurrent
connections to accept (followed by an unsigned int)
Assuming that MHD_OPTION_THREAD_POOL_SIZE is greater than zero
(i.e. thread pool is actually used) the following posibilites are
possible:
- MHD_OPTION_THREAD_POOL_SIZE => MHD_OPTION_CONNECTION_LIMIT.
In this case, I understand that MHD_OPTION_CONNECTION_LIMIT
limits the number of concurrent connections, no matter the size
of the pool.
- MHD_OPTION_THREAD_POOL_SIZE < MHD_OPTION_CONNECTION_LIMIT.
Not sure what happen in this case if all the threads in the pool
are busy and a new the process receives a new incoming
connection, among the following:
- The connection is rejected (as if it has hit the
MHD_OPTION_CONNECTION_LIMIT)
- The connection is somehow enqueued internally until a free
thread in the pool can deal with it. In that case I understand
that MHD_OPTION_CONNECTION_LIMIT is the size of such internal
queue.
- A new "extra to pool" thread is created to deal with the
incoming connection (to be destroyed once the requests has
been processed).
Which option corresponds to the actual behaviour, please?
Thanks!
Best regards,
------
Fermín
|