Skip to content

Instantly share code, notes, and snippets.

@up1
Last active July 4, 2026 03:05
Show Gist options
  • Select an option

  • Save up1/961d8856a6bf56d6508067188cd7793a to your computer and use it in GitHub Desktop.

Select an option

Save up1/961d8856a6bf56d6508067188cd7793a to your computer and use it in GitHub Desktop.
ULimit BEAM
# 1. Check in OS limit
ulimit -n
# 2. Check on system (ulimit -n cannot exceed)
cat /proc/sys/fs/file-max
# 3. check in BEAM
:erlang.system_info(:port_limit) # the +Q ceiling
:erlang.system_info(:port_count) # current usage
for i in $(seq 1 2000); do
nc localhost 4001 >/dev/null &
done
services:
beam-limit-lab:
build: .
ports:
- "4000:4000"
environment:
# Good production-style setting
ERL_AFLAGS: "+Q 65536"
ulimits:
nofile:
soft: 65536
hard: 65536
ACCEPT ERROR: :system_limit
ACCEPT ERROR: :system_limit
ACCEPT ERROR: :system_limit
ACCEPT ERROR: :system_limit
ACCEPT ERROR: :system_limit
ACCEPT ERROR: :system_limit
ACCEPT ERROR: :system_limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment