title: Error kernel Out of memory: Killed process (uwsgi) & consume too much memory
body: <p>In the past few days, my site is crashing and OS message logs shows the OOM killer kills the process.</p>
  <p>Server have 32GB RAM but still we face <strong>Out Of Memory</strong> Issue due to uwsgi.</p>
  <p>OS: Gentoo Linux</p>
  <p>Here is my uwsgi.ini</p>
  <pre><code>[uwsgi]
  chdir = /var/www/%n
  virtualenv = venv
  pythonpath = %(chdir)/python/
  socket = /var/run/uwsgi/%n.sock
  logger = syslog:%n
  vacuum = true
  module = mysite.wsgi:application
  master = true
  threads = 32
  enable-threads = true
  plugins = python27
  spooler = %(chdir)/uwsgi_spooler
  spooler-processes = 5
  spooler-frequency = 5
  import = mysite.fork
  env = LC_ALL=en_US.UTF-8
  env = LANG=en_us.UTF-8
  </code></pre>
  <p>Error Message logs</p>
  <pre><code>/var/log/messages:Jul 20 06:31:39 ip-10-0-0-45 kernel: Out of memory: Killed process 16625 (uwsgi) total-vm:6933540kB, anon-rss:1988220kB, file-rss:3676kB, shmem-rss:68kB, UID:998 pgtables:12824kB oom_score_adj:0
  /var/log/messages:Jul 20 16:02:48 ip-10-0-0-45 kernel: Out of memory: Killed process 25622 (uwsgi) total-vm:8216796kB, anon-rss:3184288kB, file-rss:4336kB, shmem-rss:72kB, UID:998 pgtables:15408kB oom_score_adj:0
  /var/log/messages:Jul 20 18:22:25 ip-10-0-0-45 kernel: Out of memory: Killed process 27520 (uwsgi) total-vm:10033820kB, anon-rss:7766404kB, file-rss:4900kB, shmem-rss:72kB, UID:998 pgtables:18960kB oom_score_adj:0
  /var/log/messages:Jul 20 18:41:47 ip-10-0-0-45 kernel: Out of memory: Killed process 26553 (uwsgi) total-vm:9450820kB, anon-rss:4271912kB, file-rss:0kB, shmem-rss:408kB, UID:998 pgtables:15804kB oom_score_adj:0
  /var/log/messages:Jul 20 18:43:58 ip-10-0-0-45 kernel: Out of memory: Killed process 26988 (uwsgi) total-vm:9023384kB, anon-rss:4560056kB, file-rss:4896kB, shmem-rss:40kB, UID:998 pgtables:17080kB oom_score_adj:0
  /var/log/messages:Jul 20 18:49:20 ip-10-0-0-45 kernel: Out of memory: Killed process 21873 (uwsgi) total-vm:9285132kB, anon-rss:3033004kB, file-rss:4832kB, shmem-rss:72kB, UID:998 pgtables:14568kB oom_score_adj:0
  /var/log/messages:Jul 20 18:51:34 ip-10-0-0-45 kernel: Out of memory: Killed process 29571 (uwsgi) total-vm:6444336kB, anon-rss:1227940kB, file-rss:3936kB, shmem-rss:48kB, UID:998 pgtables:12192kB oom_score_adj:0
  /var/log/messages:Jul 20 18:56:26 ip-10-0-0-45 kernel: Out of memory: Killed process 30172 (uwsgi) total-vm:10266664kB, anon-rss:5881624kB, file-rss:0kB, shmem-rss:128kB, UID:998 pgtables:15112kB oom_score_adj:0
  /var/log/messages:Jul 20 18:59:25 ip-10-0-0-45 kernel: Out of memory: Killed process 30274 (uwsgi) total-vm:8246172kB, anon-rss:3425064kB, file-rss:4332kB, shmem-rss:24kB, UID:998 pgtables:14092kB oom_score_adj:0
  /var/log/messages:Jul 20 19:03:30 ip-10-0-0-45 kernel: Out of memory: Killed process 30314 (uwsgi) total-vm:10782800kB, anon-rss:6666008kB, file-rss:4524kB, shmem-rss:24kB, UID:998 pgtables:18696kB oom_score_adj:0
  /var/log/messages:Jul 20 19:06:50 ip-10-0-0-45 kernel: Out of memory: Killed process 28100 (uwsgi) total-vm:11235180kB, anon-rss:4895520kB, file-rss:4384kB, shmem-rss:72kB, UID:998 pgtables:19316kB oom_score_adj:0
  /var/log/messages:Jul 20 19:11:36 ip-10-0-0-45 kernel: Out of memory: Killed process 30093 (uwsgi) total-vm:6293036kB, anon-rss:2439872kB, file-rss:4768kB, shmem-rss:72kB, UID:998 pgtables:11900kB oom_score_adj:0
  /var/log/messages:Jul 20 19:15:24 ip-10-0-0-45 kernel: Out of memory: Killed process 30552 (uwsgi) total-vm:8593196kB, anon-rss:5089644kB, file-rss:4824kB, shmem-rss:32kB, UID:998 pgtables:14448kB oom_score_adj:0
  /var/log/messages:Jul 20 19:17:35 ip-10-0-0-45 kernel: Out of memory: Killed process 30599 (uwsgi) total-vm:8656020kB, anon-rss:5878128kB, file-rss:4588kB, shmem-rss:32kB, UID:998 pgtables:13384kB oom_score_adj:0
  /var/log/messages:Jul 20 19:25:13 ip-10-0-0-45 kernel: Out of memory: Killed process 30506 (uwsgi) total-vm:6259896kB, anon-rss:3202268kB, file-rss:4460kB, shmem-rss:24kB, UID:998 pgtables:11420kB oom_score_adj:0
  /var/log/messages:Jul 20 19:47:58 ip-10-0-0-45 kernel: Out of memory: Killed process 4557 (uwsgi) total-vm:9130312kB, anon-rss:6535448kB, file-rss:4292kB, shmem-rss:48kB, UID:998 pgtables:17320kB oom_score_adj:0
  /var/log/messages:Jul 20 22:20:01 ip-10-0-0-45 kernel: Out of memory: Killed process 4896 (uwsgi) total-vm:13248296kB, anon-rss:6748320kB, file-rss:4460kB, shmem-rss:88kB, UID:998 pgtables:25424kB oom_score_adj:0
  /var/log/messages:Jul 21 18:00:58 ip-10-0-0-45 kernel: Out of memory: Killed process 6206 (uwsgi) total-vm:6823704kB, anon-rss:3321452kB, file-rss:4896kB, shmem-rss:88kB, UID:998 pgtables:12772kB oom_score_adj:0
  /var/log/messages:Jul 21 19:07:56 ip-10-0-0-45 kernel: Out of memory: Killed process 6207 (uwsgi) total-vm:6061608kB, anon-rss:2101788kB, file-rss:4208kB, shmem-rss:88kB, UID:998 pgtables:11268kB oom_score_adj:0
  /var/log/messages:Jul 21 20:06:57 ip-10-0-0-45 kernel: Out of memory: Killed process 6209 (uwsgi) total-vm:5881580kB, anon-rss:4200748kB, file-rss:4896kB, shmem-rss:72kB, UID:998 pgtables:10900kB oom_score_adj:0
  /var/log/messages:Jul 21 21:14:18 ip-10-0-0-45 kernel: Out of memory: Killed process 6211 (uwsgi) total-vm:7569124kB, anon-rss:2978188kB, file-rss:2772kB, shmem-rss:396kB, UID:998 pgtables:12000kB oom_score_adj:0
  /var/log/messages:Jul 21 21:16:39 ip-10-0-0-45 kernel: Out of memory: Killed process 8909 (uwsgi) total-vm:7548232kB, anon-rss:6601784kB, file-rss:4800kB, shmem-rss:72kB, UID:998 pgtables:14308kB oom_score_adj:0
  /var/log/messages:Jul 21 21:18:55 ip-10-0-0-45 kernel: Out of memory: Killed process 6208 (uwsgi) total-vm:9059004kB, anon-rss:4436060kB, file-rss:4640kB, shmem-rss:72kB, UID:998 pgtables:17140kB oom_score_adj:0
  /var/log/messages:Jul 21 21:22:27 ip-10-0-0-45 kernel: Out of memory: Killed process 6210 (uwsgi) total-vm:11301012kB, anon-rss:5626612kB, file-rss:4836kB, shmem-rss:72kB, UID:998 pgtables:21208kB oom_score_adj:0
  /var/log/messages:Jul 21 22:59:28 ip-10-0-0-45 kernel: Out of memory: Killed process 9244 (uwsgi) total-vm:11133048kB, anon-rss:6334996kB, file-rss:4908kB, shmem-rss:72kB, UID:998 pgtables:21364kB oom_score_adj:0
  /var/log/messages:Jul 23 06:57:58 ip-10-0-0-45 kernel: Out of memory: Killed process 27936 (uwsgi) total-vm:7728168kB, anon-rss:6061784kB, file-rss:4244kB, shmem-rss:88kB, UID:998 pgtables:14620kB oom_score_adj:0
  </code></pre>
  <p>Is there any wrong config in uwsgi.ini</p>