This question has been flagged
1 Reply
19510 Views

Hello everyone,

Hope you're all fine.

I need your help on tuning up the Odoo 12 settings for odoo-server.conf file.

I have a server with 2 CPU and 4GB RAM.

This server is hosting an e-commerce website and I fill it's slow because it has a lot of products.

Can anyone help me on setting the ideal settings for the following values:


Server:

- 2 CPU

- 4GB RAM

- Proxied under nginx


Settings I need to tune up and did not touch them:


workers = None

limit_memory_hard = None
limit_memory_soft = None
limit_request = None
limit_time_cpu = None
limit_time_real = None
limit_time_real_cron = None


I really need you help/advise.

Thank you all in advance

Best regards

PM


Avatar
Discard
Best Answer

Reference From Linuxise.com

Worker number calculation

  • Theoretical maximal number of worker = (system_cpus * 2) + 1
  • 1 worker can serve ~= 6 concurrent users
  • Cron workers also require CPU

RAM memory size calculation

  • We will consider that 20% of all requests are heavy requests, and 80% are lighter ones. Heavy requests are using around 1 GB of RAM while the lighter ones are using around 150 MB of RAM
  • Needed RAM = number_of_workers * ( (light_worker_ratio * light_worker_ram_estimation) + (heavy_worker_ratio * heavy_worker_ram_estimation) )

If you do not know how many CPUs you have on your system, use the following grep command:

grep -c ^processor /proc/cpuinfo

Let’s say you have a system with 4 CPU cores, 8 GB of RAM memory, and 30 concurrent Odoo users.

  • 30 users / 6 = **5** (5 is theoretical number of workers needed )
  • (4 * 2) + 1 = **9** ( 9 is the theoretical maximum number of workers)

Based on the calculation above, you can use 5 workers + 1 worker for the cron worker that is a total of 6 workers.

Calculate the RAM memory consumption based on the number of workers:

  • RAM = 6 * ((0.8*150) + (0.2*1024)) ~= 2 GB of RAM

The calculation shows that the Odoo installation will need around 2GB of RAM.

To switch to multiprocessing mode, open the configuration file and append the calculated values:

limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 5

Restart the ODOO server to take effect.

sudo systemctl restart odoo13

Reference Links:

https://linuxize.com/post/how-to-install-odoo-13-on-ubuntu-18-04/

https://www.odoo.com/documentation/13.0/setup/deploy.html


Avatar
Discard
Author

Dear Hilar AK,

I really thank you for the time you took on providing-me such detailled information about my question.

Many thanks and tumbs up for you

Best regards and stay safe

Paulo

Here memory bits are calculated using the format x * 1024 * 1024

Author

Hi Hilar,

Thank you once again.

Please, how did you get the values for:

limit_memory_hard = 2684354560

limit_memory_soft = 2147483648

limit_time_cpu = 600

limit_time_real = 1200

Any formula?

Thank you

limit-memory-soft = workers * 640MB

limit-memory-hard = workers * 768MB

640 & 768 MB are default values per single worker

Author

Hilar AK,

Thank you very much once again. You rock!!!

Best regards