[erlang-questions] kpoll still using select

Sverker Eriksson <>
Thu Jul 9 12:08:17 CEST 2009


Joel Reymont wrote:
>
> On Jul 9, 2009, at 10:28 AM, Sverker Eriksson wrote:
>
>> In case of kernel poll, driver_select may in some
>> cases fall back to use select or poll for individual file descriptors 
>> if the
>> OS does not support kernel poll for that device.
>
> ./configure --enable-threads --enable-smp-support --enable-kernel-poll 
> --enable-hipe
> ...
> checking for working poll()... broken or based on select()
> checking whether kqueue() fd can be select()ed on... yes
> checking whether kernel poll support should be enabled... yes; kqueue
> ...
>
> It should be using kqueue and the Erlang prompt reports that it's 
> using kqueue. In fact, I distinctly remember being able to go to at 
> least 20k connections (descriptors) when banging on OpenPoker last year.
>
> It puzzles me greatly that I cannot do better than 1024 this time around.
>
> Any suggestions on how to troubleshoot?
>
Put some printf's in erts/emulator/sys/common/erl_poll.c. This is where 
the file descriptor limit is set at start:

void
ERTS_POLL_EXPORT(erts_poll_init)(void)
{
    erts_smp_spinlock_init(&pollsets_lock, "pollsets_lock");
    pollsets = NULL;

    errno = 0;

#if defined(VXWORKS)
    max_fds = erts_vxworks_max_files;
#elif !defined(NO_SYSCONF)
    max_fds = sysconf(_SC_OPEN_MAX);
#elif ERTS_POLL_USE_SELECT
    max_fds = NOFILE;
#else
    max_fds = OPEN_MAX;
#endif

#if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE)
    if (max_fds > FD_SETSIZE)
    max_fds = FD_SETSIZE;
#endif

    if (max_fds < 0)
    fatal_error("erts_poll_init(): Failed to get max number of files: %s\n",
            erl_errno_id(errno));

#ifdef ERTS_POLL_DEBUG_PRINT
    print_misc_debug_info();
#endif
}


/Sverker, Erlang/OTP



More information about the erlang-questions mailing list