[erlang-questions] {error,emfile}
Pamelard Stephane
stephane.pamelard@REDACTED
Wed Jan 7 17:27:21 CET 2015
Hi Roberto,
Have you tried to increase ERL_MAX_PORTS env variable value? Its default
value is 1024.
Hope that could help.
BR,
Stéphane
Le 07/01/2015 17:20, Jon Schneider a écrit :
> Could it be due to FD_SETSIZE ? Even if Erlang itself might be able to
> handle many more sockets there are still things constrained by this.
>
> Jon
>
>> Dear all,
>> I've built a benchmarking tool and I experience an error when connecting
>> more than 1024 clients to a SSL server. The call to ssl:connect/3 returns
>> a
>> {error,emfile} instead of a Socket.
>>
>> According to inet POSIX Error Codes [1], emfile corresponds to too many
>> open files.
>> I'm running from a UBUNTU 14.04 LTS box.
>>
>> However, I've set my /etc/security/limits.conf with:
>>
>> * soft nofile 999999
>> * hard nofile 999999
>>
>> and rebooted the machine. I can see it applied:
>>
>> $ ulimit -a
>> core file size (blocks, -c) 0
>> data seg size (kbytes, -d) unlimited
>> scheduling priority (-e) 0
>> file size (blocks, -f) unlimited
>> pending signals (-i) 241197
>> max locked memory (kbytes, -l) 64
>> max memory size (kbytes, -m) unlimited
>> open files (-n) 999999
>> pipe size (512 bytes, -p) 8
>> POSIX message queues (bytes, -q) 819200
>> real-time priority (-r) 0
>> stack size (kbytes, -s) 8192
>> cpu time (seconds, -t) unlimited
>> max user processes (-u) 241197
>> virtual memory (kbytes, -v) unlimited
>> file locks (-x) unlimited
>>
>>
>> I've also set /etc/sysctl.conf with:
>>
>> # number of file descriptors
>> fs.file-max=2001000
>>
>> # extend the ports range
>> net.ipv4.ip_local_port_range=1024 65535
>>
>> # increase the max number of receive and send buffer size
>> net.core.rmem_max=33554432
>> net.core.wmem_max=33554432
>>
>> # increase TCP auto-tuning buffer limits settings
>> net.ipv4.tcp_rmem=4096 16384 33554432
>> net.ipv4.tcp_wmem=4096 16384 33554432
>> net.ipv4.tcp_mem=786432 1048576 26777216
>>
>> # increase the number of memory map areas for the server process
>> vm.max_map_count=131060
>>
>> # swap only to avoid an out of memory condition
>> vm.swappiness=0
>>
>> # try to always keep 64MB of RAM free
>> vm.min_free_kbytes=65536
>>
>> # prevent flooding detection when receiving large number of SYN packets
>> # use with care as they can detec DoS attacks
>> # needed with artificial loads while running the benchmark
>> net.ipv4.tcp_max_tw_buckets=360000
>> net.core.somaxconn=4096
>> net.ipv4.tcp_max_syn_backlog=16000
>> net.ipv4.tcp_syncookies=0
>> net.ipv4.tcp_tw_recycle=1
>>
>> # insure keepalive is enabled - use only if needed
>> net.ipv4.tcp_keepalive_time=900
>> net.ipv4.tcp_keepalive_intvl=180
>> net.ipv4.tcp_keepalive_probes=5
>>
>> And applied them with sudo sysctl -p /etc/sysctl.conf.
>>
>> Finally, in my Erlang release I've set into vm.args:
>>
>> +K true
>> +P 2000000
>> +Q 1000000
>> +A 10
>>
>> When I run my release and attach to the node, I can see:
>>
>> 1> erlang:system_info(check_io).
>> [{name,erts_poll},
>> {primary,epoll},
>> {fallback,poll},
>> {kernel_poll,epoll},
>> {memory_size,113328},
>> {total_poll_set_size,1243},
>> {fallback_poll_set_size,0},
>> {lazy_updates,true},
>> {pending_updates,0},
>> {batch_updates,false},
>> {concurrent_updates,true},
>> {max_fds,999999},
>> {active_fds,1}]
>>
>> After all this I cannot connect more than 1024 outgoing HTTPS clients.
>>
>> Any ideas?
>>
>> Thank you,
>> r.
>>
>>
>>
>> [1] http://erlang.org/doc/man/inet.html#id132028
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
*** DISCLAIMER *** This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.
More information about the erlang-questions
mailing list