odoo_calculator.py 1.2 KB

123456789101112131415161718192021222324252627
  1. import psutil
  2. logical_cpu = psutil.cpu_count()
  3. physical_cpu = psutil.cpu_count(logical=False)
  4. mem = psutil.virtual_memory()
  5. total_mem = mem.total
  6. worker = 1 + (physical_cpu * 2)
  7. limit_memory_soft = 640 * worker
  8. hard_memory_soft = 768 * worker
  9. shared_buffer = 0
  10. if mem < pow(1024, 3):
  11. shared_buffer = total_mem / 4;
  12. else:
  13. shared_buffer = total_mem * 0.15
  14. print '----------------------------------------Results-------------------------------------------'
  15. print 'Logical CPU ---> %s' % logical_cpu
  16. print 'Physical CPU ---> %s' % physical_cpu
  17. print 'Total Memory ---> %.2f bytes - %.2f kb - %.2f mb - %.2f gb' % (total_mem, total_mem / 1024, total_mem / pow(1024, 2), total_mem / pow(1024, 3))
  18. print '------------------------------------------------------------------------------------------'
  19. print 'Odoo Workers ---> %s' % worker
  20. print 'Odoo Limit Memory Soft ---> %.2f mb' % limit_memory_soft
  21. print 'Odoo Hard Memory Soft ---> %.2f mb' % hard_memory_soft
  22. print 'Postgres Shared Buffer ---> %.2f bytes - %.2f kb - %.2f mb - %.2f gb' % (shared_buffer, shared_buffer / 1024, shared_buffer / pow(1024, 2), shared_buffer / pow(1024, 3))
  23. print '------------------------------------------------------------------------------------------'