Max number of open file descriptors is too low

Joel Reymont joelr1@REDACTED
Wed Sep 28 14:30:31 CEST 2005


So Mac OSX is not a good platform for running Erlang servers with a  
high number of simultaneous connections, right?

I do see this code for Windows so ERL_MAX_PORTS would work there. I'm  
on Mac OSX, though, and I do not want to run Windows :-(

---
void
sys_init_io(byte *buf, Uint size)
{
     tmp_buf = buf;
     tmp_buf_size = size;
     cerr_pos = 0;

     /* Now heres an icky one... This is called before drivers are,  
so we
        can change our view of the number of open files possible.
        We estimate the number to twice the amount of ports.
        We really dont know on windows, do we? */
     max_files = 2*erts_max_ports;
---

The whole thing is sad although I do understand the issues. I noticed  
that my server starts misbehaving at about 2,200 connections. No more  
connections are accepted roughly at that point. Could have something  
to do with select() and the number of open sockets.

     Thanks, Joel

On Sep 28, 2005, at 1:48 PM, Bjorn Gustavsson wrote:

> The code is correct.
>
> max_files will be adjusted downwards only if select() is actually  
> used.
>
> On Mac OS X select() IS used. On Mac OS X 10.3, poll() is actually
> emulated using select(), so we call select() ourselves. On Mac OS X  
> 10.4,
> there is a real poll() but it does not work for devices (including the
> terminal), so we use select() instead.

--
http://wagerlabs.com/







More information about the erlang-questions mailing list