[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Re : Re: Re : Re: Re : Re: External select mode limi
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Re : Re: Re : Re: Re : Re: External select mode limited to 1024 FDs |
Date: |
Mon, 16 Mar 2015 20:31:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0 |
Hi Louis,
Ah, yes, you're right, I was confused, misremembered and should have
checked the code before answering. While way in the distant past
thread-per-connection didn't use select/poll, we had to put in a
poll/select a few years ago for the timeout handling of the threads
(once we supported timeouts for connections).
Anyway, you can simply do THREAD_PER_CONNECTION with MHD_USE_POLL and
then you have no FD-size limit and do have O(1) operations for everything.
Sorry for my confusion.
Happy hacking!
Christian
On 03/16/2015 06:27 PM, address@hidden wrote:
> Hi Christian,
>
> Looking at the 0.9.38 source code, I am getting confused.
> Setting MHD_USE_THREAD_PER_CONNECTION eventually results in creating two
> threads:
> create_thread (&daemon->pid, daemon, &MHD_select_thread, daemon)
> create_thread (&connection->pid, daemon, &MHD_handle_connection, connection)
> Entry points MHD_select_thread eventually calls select() on the listening
> socket.
> Entry points MHD_handle_connection eventually calls select() on the
> connection socket.
>
> Louis
>
> Le 16/03/15, Christian Grothoff <address@hidden> a écrit :
>> On 03/16/2015 05:09 PM, address@hidden wrote:
>>> Le 11/03/15, *Christian Grothoff * <address@hidden> a écrit :
>>>> On 03/11/2015 12:58 PM, address@hidden wrote:
>>>>> Hi Christian,
>>>>>
>>>>> I wanted to use external threads because my system has the following
>>>>> constraints:
>>>>> 1) One connection per thread: the response to the client is time critical
>>>>> and I cannot afford that a connection delays another one.
>>>>
>>>> Then you should use the one-thread-per-connection mode, that is exactly
>>>> what you want. MHD will use a thread for each connection, which matches
>>>> your requirements. This method also has no limits on open FDs as MHD
>>>> doesn't use select() but blocking read/write operations instead.
>>>
>>> Are you refering to MHD_USE_THREAD_PER_CONNECTION?
>>
>> Yes.
>>
>>> Or using
>>> MHD_OPTION_CONNECTION_LIMIT
>>
>> No, that option has nothing to do with the threading modes.
>>
>>> set to MHD_OPTION_THREAD_POOL_SIZE?
>>
>> No, a thread pool is again different, as there you use one thread to
>> handle multiple connections, which may give you the delays you found so
>> problematic.
>>
>>> In both cases shouldn't I use MHD_USE_POLL in order not to use select ()?
>>
>> MHD_USE_POLL has no impact on MHD_USE_THREAD_PER_CONNECTION, as in that
>> case neither select() nor poll() are used anyway.
>>
>> Happy hacking!
>>
>> Christian
>>
>>
>
- [libmicrohttpd] External select mode limited to 1024 FDs, louisbenoit, 2015/03/04
- Re: [libmicrohttpd] External select mode limited to 1024 FDs, Christian Grothoff, 2015/03/05
- Message not available
- [libmicrohttpd] Re : Re: External select mode limited to 1024 FDs, louisbenoit, 2015/03/11
- Re: [libmicrohttpd] Re : Re: External select mode limited to 1024 FDs, Christian Grothoff, 2015/03/11
- Message not available
- [libmicrohttpd] Re : Re: Re : Re: External select mode limited to 1024 FDs, louisbenoit, 2015/03/16
- Re: [libmicrohttpd] Re : Re: Re : Re: External select mode limited to 1024 FDs, Christian Grothoff, 2015/03/16
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- [libmicrohttpd] Re : Re: Re : Re: Re : Re: External select mode limited to 1024 FDs, louisbenoit, 2015/03/16
- Re: [libmicrohttpd] Re : Re: Re : Re: Re : Re: External select mode limited to 1024 FDs,
Christian Grothoff <=
Re: [libmicrohttpd] External select mode limited to 1024 FDs, Luke Dashjr, 2015/03/11