2

I'm trying to open connections (sockets) to my Erlang server; everything works fine with around 100 paralell connections, but when I want more than 100 i get {error, closed}.

It may be something that has to do with OS file descriptor limit? If yes, can you guys please give me a solution? I use MacOS and CentOS.

Should I give some params to the Erlang Vm in vm.args file?

Ștefan Stan
  • 223
  • 1
  • 7
  • See `ulimit -n`. Refer to [this](http://stackoverflow.com/questions/7578594/how-to-increase-limits-on-sockets-on-osx-for-load-testing) for MacOS for example – Lol4t0 Sep 05 '15 at 07:34

1 Answers1

0

Open sockets limit in erlang relies on two things:

  1. OS max open files limit, you can check how two tune it here
  2. Erlang VM +Q flag for max open ports, check out it here
danechkin
  • 1,306
  • 8
  • 15
  • 1
    You are right, those steps are required, but I also need to pass an argument to the listen call. That is the {backlog, SomeNumber}. The default value is 5 for backlog. With these 3 steps I did what I wanted, thanks for help. – Ștefan Stan Sep 15 '15 at 09:12
  • I still didn't work for more than around 100 connections, on ssl:connect I receive econnreset – Ștefan Stan Sep 16 '15 at 06:10
  • It is little bit tricky to apply all these changes. I am not a MacOS advanced user, so I can give advice how to check things under linux: – danechkin Sep 16 '15 at 16:11
  • with help of `ps aux | grep beam` find erlang vm process id, then `cat /proc/PID/limits | grep "Max open files"`. Make sure that it is the same as you set in OS limits. – danechkin Sep 16 '15 at 16:14