[Top][All Lists]

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

[libmicrohttpd] Doubts regarding how MHD_OPTION_THREAD_POOL_SIZE and MHD

From: Fermín Galán Márquez
Subject: [libmicrohttpd] Doubts regarding how MHD_OPTION_THREAD_POOL_SIZE and MHD_OPTION_CONNECTION_LIMIT interact together
Date: Wed, 7 Dec 2016 12:15:39 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1


I have some doubts regarding how MHD_OPTION_THREAD_POOL_SIZE and MHD_OPTION_CONNECTION_LIMIT interact together. From MHD documentation at

  • 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:
    1. The connection is rejected (as if it has hit the MHD_OPTION_CONNECTION_LIMIT)
    2. 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.
    3. 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?


Best regards,


reply via email to

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