Skip to Content
Menu
This question has been flagged
5 Replies
84834 Views

Can someone please tell me the very right way to calculate these values for odoo self-hosted server setup with multiprocessing ->


  1. Number of worker

  2. limit_memory_hard 

  3. limit_memory_soft

  4. max_cron_threads   

Here is my server specifications ->

RAM -> 16 GB

CPU -> 8 core



Avatar
Discard
Best Answer

LAST UPDATED SEPTEMBER 2024


if you ever bought groceries from a large supermarket with multiple checkout cashiers using registers then you have been in a situation supported by workers.

Each checkout is staffed by a worker and each worker has a line of Customers to help.

How many cashiers needed depends on

  • how many Customers are ready to leave; and 
  • how many items each of them have.

It could be that a worker could manage:

  • 100 customers an hour scanning 8 to 12 items per transaction.
  • 10 customers an hour scanning 80 to 120 items per transaction.
  • 1 customer an hour scanning 800 to 1200 items per transaction.

 

For planning purposes, you should start with 1 worker per: 

  • 25 users or 
  • 5,000 daily visitors. 

The resources Odoo uses can vary a great deal depending on:

  • what features are available 
  • how often they are used
  • balance of user / visitor ratio
  • spread of visitor count over time (steady), vs concentrated (surge)
  • how much CUSTOM code has been installed

 

Given this, you only really know how many workers you need when you are live, so should be monitoring your performance prior to go live, during testing, and after go live in case you need to rollback to a point where performance was not an issue.

 

In addition to using logging (and looking at log files) we provide RESOURCE MONITORING features with Odoo.sh:

 

With this in mind:

1 worker is about 6 concurrent users.

ie: ALL clicking a button at the "exact same time".  

Up to 99% of the time users read, type or scroll and that does not count as 'using' Odoo since no server resources are consumed.  Only when a User or Visitor clicks a button, runs a report, imports data, etc. are server resources consumed.

 

Considerations:

  • Using Odoo once a day for time sheets is considered EXTREMELY LIGHT use
  • Using Odoo all day long without a break is considered EXTREMELY HEAVY use. 
  • Most are somewhere in between so test LIGHT, MEDIUM and HEAVY use scenarios.
  • 1 worker could support 50 users or 100 users, depending on the scenario.
  • 1 worker could support 10,000 an day or 5,000 an hour, depending on the scenario.   

 

The great thing about Odoo.sh is that extra workers are not hard to add.

 

This same strategy applies for ON PREMISE installations of Odoo.

 



Avatar
Discard
Best Answer

RAM -> 16 GB

CPU -> 8 core


(CPU cores * 2 + 1) = 17
limit-memory-soft = 640MB*17 = 10880 MB = 10880 * 1024*1024
limit-memory-hard 768MB*17 = 13056 MB = 13056*1024*1024

workers = 17 limit_memory_hard = 13690208256 limit_memory_soft = 11408506880 limit_request = 8192 limit_time_cpu = 60 limit_time_real = 120 max_cron_threads = 2
Avatar
Discard

Hi,
sorry but as Ryan Tran said, this calculation is not correct regarding to Odoo V14-15.

1.)
With an 8 Core CPU you can theoretically use max. 17 worker (if you have enough memory installed). But you need also CPU power for other processes like OS and Postgres. And by the way the parameter "max_cron_threads" is using/starting 2 worker processes, too. You can see this in the Odoo log after the odoo service starts. So you can add in the "workers" parameter only 15 from your theoretical max. available 17 workers (or less - depends on the max. available memory and installed programs). I'm not sure but I believe that the longpolling process needs also 1 worker (Odoo Documentation: "In multiprocessing, a dedicated LiveChat worker is automatically started and listening on the longpolling port but the client will not connect to it.").

2.)
The values 640MB and 768MB for the memory limits are default values from Odoo V10 and not state of the art in the year 2021. The default values from Odoo V14-15 are 2048 MB and 2560 MB per Worker.

3.)
According to the Odoo documentation are the memory limit values specified per worker and are no total values as you have added. An better formula will be -> Available Memory for Odoo = (Max. Memory in byte - needed Memory for OS and other Apps like Postgres) / max. workers

Original text from the Odoo V15 manual (odoo-bin --help):
--limit-memory-soft=LIMIT_MEMORY_SOFT
Maximum allowed virtual memory per worker (in bytes), when reached the worker be reset after the current request (default 2048MiB).

--limit-memory-hard=LIMIT_MEMORY_HARD
Maximum allowed virtual memory per worker (in bytes), when reached, any memory allocation will fail (default 2560MiB).

4.)
In your calculation is specified round about 13,7 GB RAM per worker for the hard memory limit. You configured 19 workes, so you need theoretically 260 GB Memory when all workers produce an heavy load. But with this settings already if 1-2 workers produce an high load you will receive an out of momory error in your operation system and your linux will freeze (e.g. when a user create an pdf report with 200-500 pages).

Hi Nicky,

Is the calculation of memory indeed per worker or is it as per documentation of Odoo itself, per server:

https://www.odoo.com/documentation/16.0/administration/install/deploy.html#id5

Configuration sample
Server with 4 CPU, 8 Thread

60 concurrent users

60 users / 6 = 10 <- theoretical number of worker needed

(4 * 2) + 1 = 9 <- theoretical maximal number of worker

We’ll use 8 workers + 1 for cron. We’ll also use a monitoring system to measure cpu load, and check if it’s between 7 and 7.5 .

RAM = 9 * ((0.8*150) + (0.2*1024)) ~= 3Go RAM for Odoo

in /etc/odoo.conf:

[options]
limit_memory_hard = 1677721600
limit_memory_soft = 629145600
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 8

After digging into this some more it looks like Nicky's explanation is correct. The source code for the file config.py (line 325 and on) confirms that settings like limit_memory_hard are PER worker.

https://github.com/odoo/odoo/blob/fa58938b3e2477f0db22cc31d4f5e6b5024f478b/odoo/tools/config.py

Further, it seems that the calculations given assume that Odoo is the only service running on the system. This may or may not be the case of course and in that case, available resources should be reduced accordingly.

Author Best Answer

odoo worker and memory calculations based on various theories and practicals (Use at your own risk) :


1 worker can handle around 6 concurrent users.

So, for example, if we have 60 concurrent users daily, we should use around 10 workers.


So,

limit-memory-soft = 2000 MB X 10 worker = 20000 MB (This should not exceed more than actual RAM) * 1024 * 1024 = 20971520000

 
limit-memory-hard = 2500 MB X 10 worker = 25000 MB (This should not exceed more than actual RAM) * 1024 * 1024 = 26214400000

2000 MB and 2500 MB are standard values for odoo V13, odoo V14 and odoo V15.

In case, your calculation exceeds actual RAM on the server, then either increase RAM on the server or lower the number of workers.

Avatar
Discard
Best Answer

Here are the guidelines provided by Odoo:

https://www.odoo.com/documentation/13.0/setup/deploy.html#builtin-server

Avatar
Discard
Best Answer

The answer which is marked as the solution could be considered incorrect. The total worker has included the cron workers, so (workers = 17 - max_cron_threads). On the documentation page, the RAM is computed from the number of workers. The param limit_memory_hard and limit_memory_soft are the limits for EACH WORKER, with limit_memory_hard ~ limit_memory_soft * 2.5 (regarding the documentation). 

Avatar
Discard

the calculation is correct.

Related Posts Replies Views Activity
2
Sep 23
5521
1
Apr 21
2867
5
Dec 23
62467
1
Sep 15
12656
2
Oct 20
6616