[erlang-questions] Increase the handle limit

Dave Cottlehuber <>
Mon Oct 24 22:31:06 CEST 2011


On 21 October 2011 23:19, Jon Watte <> wrote:
> FD_SETSIZE is 64 on Windows, probably because that is the limit for
> efficient implementation of select() using MsgWaitForMultipleObjectsEx().
> However, all efficient I/O on Windows uses I/O completion ports, which are a
> lot more efficient than select() (more like epoll on Linux). I imagine
> Erlang uses IOCP as well on Windows, but I don't know for sure.
> The erl environment has various "raise these limits" options. We start ours
> with something like:
> -env ERL_MAX_PORTS 200500
> +P 1001001
> This lets us spawn over a million processes and open two hundred thousand
> sockets and files. (The machine itself also has increased the ulimit for the
> number of file descriptors)
> Hope this helps!
> Sincerely,
> jw

Thanks Jon,

Re-running Peer's test module with raised higher ERL_MAX_PORTS yielded
over 250000 open files before I decided the point was proven.

For reference the most docs I found on this are in open_port/2 in erts
[1] and some comments in the archives [2].

A+
Dave

[1]: http://www.erlang.org/doc/apps/erts/erts.pdf
[2]: http://erlang.2086793.n4.nabble.com/error-emfile-on-windows-td3064840.html



More information about the erlang-questions mailing list