Skip to content

Instantly share code, notes, and snippets.

@dpeterka
Created March 24, 2016 16:59
Show Gist options
  • Save dpeterka/8cc3e88f2fca2f882d0d to your computer and use it in GitHub Desktop.
Save dpeterka/8cc3e88f2fca2f882d0d to your computer and use it in GitHub Desktop.
# Percent of total sytem memory to use
xmx_percent=.7 # Memory to use for supervisord and the OS
worker_mem=1000 # Memory per worker
# Total system memory available
system_memory_in_mb=$(free -m | awk '/Mem:/ {print $2}')
xmx_memory_float=$(echo "$system_memory_in_mb*$xmx_percent"|bc)
xmx_memory=$(echo "($xmx_memory_float+0.5)/1" | bc)
num_workers_float=$(echo "$xmx_memory/$worker_mem"|bc)
num_workers=$(echo "($num_workers_float+0.5)/1" | bc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment