The script should set the max ports to the ulimit -n
# Increase this if you expect a lot of concurrent connections. For example
# if you use comet on popular pages.
# Please check the documentation of your system on how to increase
# the maximum number of open files your operating system.
While we are at it, also the number of processes should be increased.
In debug we use +P 10000000
In production this parameter is missing (as is +K).
+1 for a ulimit -n default. (Btw it can be unlimited)
In production I have set the ulimit for zotonic very high and use MAX_PORTS to limit it, but it is always possible to override. This allows me to increase the number quickly without going through a reboot of the whole server first.
Btw, I've also hit the maximum number of ets tables limit. This is really not fun because it crashes the whole VM.
It is a bit tricky to pass environment variables to the erl vm because of the way the start scripts work.
Maybe it is an idea to investigate whether https://github.com/ShoreTel-Inc/erld is a better option to start zotonic. The current setup has some problems when things spin out of control. On a heavy loaded machine for instance it can be very hard to kill zotonic because heart keeps restarting it and heart keeps restarting zotonic.
core: Allow +K and +P arguments to be set and add sane defaults.