title: High idle load in Odoo / OpenERP when using multiple worker processes
body: <p>I want to share our results of a performance analsis of Odoo V9 ERP System. </p>
  
  <h2>Problem / Symptoms</h2>
  
  <p>When running multiple worker processes in odoo, odoo consumes 1 cpu continously without any requests, so we had an average system load of &lt;1.</p>
  
  <pre><code>top - 12:13:54 up 1 day, 35 min,  3 users,  load average: 0.92, 0.82, 0.79
  Tasks: 149 total,   3 running, 146 sleeping,   0 stopped,   0 zombie
  %Cpu0  :  0.0 us,  3.7 sy,  0.0 ni, 96.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
  %Cpu1  : 63.0 us, 20.4 sy,  0.0 ni, 16.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
  %Cpu2  :  5.6 us,  0.0 sy,  0.0 ni, 94.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
  %Cpu3  :  5.6 us,  7.4 sy,  0.0 ni, 85.2 id,  0.0 wa,  0.0 hi,  0.0 si,  1.9 st
  KiB Mem:   4047120 total,  1660760 used,  2386360 free,   159696 buffers
  KiB Swap:  4194300 total,        0 used,  4194300 free.  1040260 cached Mem
  
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  12345 odoo      20   0  226576  59732  13184 S   9.3  1.5   0:50.94 odoo.py
  </code></pre>
  
  <h2>Analysis</h2>
  
  <pre><code>ps -eo pcpu,pid,user,args | sort -b -k1,1n
  </code></pre>
  
  <p>The last line shows the cpu-consuming process. Should be normally the same PID that you can see in the top of "top". </p>
  
  <pre><code>0.3 12345 odoo     /usr/bin/python /usr/bin/openerp-gevent --config /etc/odoo/openerp-server.conf --logfile /var/log/odoo/odoo-server.log
  </code></pre>
  
  <p>So, we're running an strace:</p>
  
  <pre><code>strace -o 12345.log -vtffp 12345
  </code></pre>
  
  <p>After some seconds you can disconnect from the process using STRG-C</p>
  
  <p>Now you'll find some files like </p>
  
  <ul>
  <li>12345.log.12345</li>
  <li>12345.log.12346</li>
  <li>12345.log.12347</li>
  <li>12345.log.12349</li>
  </ul>
  
  <p>If your strace will stop the child processes</p>
  
  <pre><code>12:13:54 stat("/usr/lib/pymodules/python2.7/psycogreen", 0x7fffcf562920) = -1 ENOENT (No such file or directory)
  12:13:54 open("/usr/lib/pymodules/python2.7/psycogreen.x86_64-linux-gnu.so", O_RDONLY) = -1 ENOENT (No such file or directory)
  12:13:54 open("/usr/lib/pymodules/python2.7/psycogreen.so", O_RDONLY) = -1 ENOENT (No such file or directory)
  12:13:54 open("/usr/lib/pymodules/python2.7/psycogreenmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
  12:13:54 open("/usr/lib/pymodules/python2.7/psycogreen.py", O_RDONLY) = -1 ENOENT (No such file or directory)
  12:13:54 open("/usr/lib/pymodules/python2.7/psycogreen.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
  12:13:54 write(2, "Traceback (most recent call last"..., 35) = 35
  12:13:54 write(2, "  File \"/usr/bin/openerp-gevent\""..., 54) = 54
  12:13:54 open("/usr/bin/openerp-gevent", O_RDONLY) = 4
  12:13:54 fstat(4, {st_dev=makedev(252, 0), st_ino=1062415, st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=196, st_atime=2016/03/09-16:12:19, st_mtime=2016/02/19-13:13:35, st_ctime=2016/03/09-16:10:52}) = 0
  12:13:54 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f02133e1000
  12:13:54 read(4, "#!/usr/bin/env python\n\nimport ge"..., 4096) = 196
  12:13:54 write(2, "    ", 4)            = 4
  12:13:54 write(2, "import psycogreen.gevent\n", 25) = 25
  12:13:54 close(4)                       = 0
  12:13:54 munmap(0x7f02133e1000, 4096)   = 0
  12:13:54 write(2, "ImportError", 11)    = 11
  12:13:54 write(2, ": ", 2)              = 2
  12:13:54 write(2, "No module named psycogreen.geven"..., 33) = 33
  12:13:54 write(2, "\n", 1)              = 1
  12:13:54 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f0212fb4340}, {0x45a0f5, [], SA_RESTORER, 0x7f0212fb4340}, 8) = 0
  12:13:54 exit_group(1)                  = ?
  12:13:54 +++ exited with 1 +++
  </code></pre>