Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Memory / Settings Matrix #49

Closed
DocCyblade opened this issue Oct 15, 2015 · 30 comments
Closed

Create Memory / Settings Matrix #49

DocCyblade opened this issue Oct 15, 2015 · 30 comments
Assignees
Milestone

Comments

@DocCyblade
Copy link
Owner

EDIT POST:


A word on tuning your TurnkKey Linux Odoo Server

A lot of time has gone in to testing this TKL appliance, and one thing we
learned while testing was tuning. For all the why we chose these numbers you
can take a look at he issues on GitHub (links at the botton of this article)

Most of this text here was taken from the Memory Matrix Discussion
#49 (comment)

It is important to note that you can run Odoo in threaded mode by setting
the workers option to 0 however there are some modules that won't work
and you loose fine grain control of resource management.


the --workers is how many new process will be started to perform work or
(answer requests) The workers have limits upon them set by the limit_xxxxx
options here in the config file.

The "limit_memory_soft" limit is the amount of ram that when a process
goes over this limit after it is done with the request it is terminated
and the memory it was using is freed. This amount goes for each process

The hard limit is the amount of ram that if the process goes over it,
it WILL terminate right then. (I don't think this is really correct
because of the PDF issue we had and set this to 1.3 GB and never
saw a process take this much. but if its below 1.3GB PDF are not created)

The one we need to pay attention to is the limit_memory_soft.
As these workers will stay alive and hold on to memory until that limit
is reached. So if you have 5 workers and the soft limit is 256MB you could
end up with 5 workers each taking 256MB that's 1.25GB of RAM that could
be taken up. If you only had 1GB of ram you may need to dial back your
workers or your soft limit.

It's a balancing act of sorts, I am also not sure if keeping the
workers at say 350 or 400 if there is some caching effect. Not sure
why it's holding on to the memory.


Hardware Matrix for recommended values:
(Note these are for REAL hardware, Virtual Hardware has it's own
issues that can arise with too many guest on a host with too many
CPU cores etc, so remember that when looking at the chart below)
(One other note that when I tested these, I did use VMware but
no other VMs where competing for resources)
(One last note, really. These numbers are to show the relationship
between the config settings and hardware. We also assume you are running
the database server on the same server. I know at some point in the
higher numbers that this would not be the case. These are not numbers
set in stone nor numbers gotten from Odoo. These are numbers I have
come up with from the testing I have done. Real world examples if you
have them would be great and these numbers can and should be updated!

Heading Description
CPUs Number of CPU Cores not threads
Physical Physical memory, not virtual or swap
workers Number of workers specified in config file (workers = x)
cron Number of workers for cron jobs (max_cron_threads = xx)
Mem Per Memory in MB that is the max memory for request per worker
Max Mem Maximum amount that can be used by all workers
limit_memory_soft Number in bytes that you will use for this setting

Note: Max Memory if notice is less than total memory this is on purpose. As
workers process requests they can grow beyond the Mem Per limit so a
server under heavy load could go past this amount. This is why there
is "head room" built in.

CPUs Physical workers cron Mem Per Max Mem limit_memory_soft
ANY =< 256MB NR NR NR NR NR
1 512MB 0 N/A N/A N/A N/A
1 512MB 1 1 177MB 354MB 185127901
1 1GB 2 1 244MB 732MB 255652815
1 2GB 2 1 506MB 1518MB 530242876
2 1GB 3 1 183MB 732MB 191739611
2 2GB 5 2 217MB 1519MB 227246947
2 4GB 5 2 450MB 3150MB 471974428
4 2GB 5 2 217MB 1519MB 227246947
4 4GB 9 2 286MB 3146MB 300347363
4 8GB 9 3 546MB 6552MB 572662306
4 16GB 9 3 1187MB 14244MB 1244918057
6 12GB 10 4 763MB 10682MB 800304465
6 16GB 13 4 838MB 14246MB 878765687
6 32GB 13 4 1676MB 28492MB 81757531374
8 32GB 17 5 1295MB 28490MB 1358092426
8 64GB 17 5 2590MB 56980MB 2716184851

Calculations on how we got the above chart

M = Total memory in bytes (1048576 = 1MB)
W = Workers (workers )
CW = Cron workers (max_cron_threads)
TW = W + CW

For ram 512 to 999MB
((TW * 0.45 ) + TW) / M = limit_soft_memory

1GB - 1.99GB
(TW * 0.40 ) + (TW - 1) / M = limit_soft_memory

2GB - 3.99GB
(TW * 0.35 ) + (TW - 1) / M = limit_soft_memory

4GB - 7.99GB
(TW * 0.30 ) + (TW - 2) / M = limit_soft_memory

8GB + 11.99GB
(TW * 0.25 ) + (TW - 3) / M = limit_soft_memory

12GB +
(TW * 0.15 ) + (TW - 3) / M = limit_soft_memory

Memory Matrix Discussion
#49

Shakedown Testing Discussions
#52
#53
#54
#55

@DocCyblade
Copy link
Owner Author

Reply from #47

@JedMeister - I too wondered what this means. I did some reading (what I could find) and seems it's only used for multi processes. (were workers number is greater that 0) There are modules that require this mode to be enabled. This limit is not very well documented. I only found places from google where people were having the problem and were told to increase this number (some by a huge amount). What I did was kept changing the hard limit until it started working. 1.5G was that number. I watched the processes in TOP and I did not see any of the processes go over that limit while processing a bunch of PDF reports.

According to Odoo Docs

--workers <count>
if count is not 0 (the default), enables multiprocessing and sets up the specified number of HTTP workers (sub-processes processing HTTP and RPC requests).

Note
multiprocessing mode is only available on Unix-based systems

A number of options allow limiting and recycling workers:

--limit-request <limit>
Number of requests a worker will process before being recycled and restarted.
Defaults to 8196.


--limit-memory-soft <limit>
Maximum allowed virtual memory per worker. If the limit is exceeded, the worker is killed and recycled at the end of the current request.
Defaults to 640MB.


--limit-memory-hard <limit>
Hard limit on virtual memory, any worker exceeding the limit will be immediately killed without waiting for the end of the current request processing.
Defaults to 768MB.


--limit-time-cpu <limit>
Prevents the worker from using more than <limit> CPU seconds for each request. If the limit is exceeded, the worker is killed.
Defaults to 60.

--limit-time-real <limit>
Prevents the worker from taking longer than <limit> seconds to process a request. If the limit is exceeded, the worker is killed.
Differs from --limit-time-cpu in that this is a "wall time" limit including e.g. SQL queries.
Defaults to 120.


--max-cron-threads <count>
number of workers dedicated to cron jobs. Defaults to 2. The workers are threads in multithreading mode and processes in multiprocessing mode.

For multiprocessing mode, this is in addition to the HTTP worker processes.

Other reads I found:
https://www.odoo.com/nl_NL/forum/help-1/question/difference-between-built-in-multiprocessor-mode-and-gunicorn-1671

http://docs.gunicorn.org/en/latest/settings.html

@DocCyblade
Copy link
Owner Author

Did some testing
VM Specs
1 CPU / 256MB RAM

This is at the peak of creating a database with demo data and installing one module

top - 09:58:13 up 30 min,  1 user,  load average: 1.10, 0.51, 0.22
Tasks: 172 total,   1 running, 171 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem:   228.977 total,  225.234 used,    3.742 free,    0.059 buffers
MiB Swap:  507.996 total,  354.598 used,  153.398 free.   27.465 cached Mem

   PID %MEM    VIRT   SWAP    RES   CODE    DATA    SHR nMaj nDRT S  PR  NI %CPU COMMAND                                         
  3979 37.6  271.3m  24.1m  86.2m   3.1m  101.6m   7.8m  21k    0 S  20   0  0.3 python /opt/openerp/odoo/openerp-server --confi+
  3978 13.1  264.3m  69.9m  30.1m   3.1m   94.5m   4.7m  44k    0 S  20   0  0.0 python /opt/openerp/odoo/openerp-server --confi+
  3980  2.5  327.6m  80.5m   5.7m   3.1m  155.5m   1.6m  27k    0 S  20   0  0.0 /usr/bin/python /opt/openerp/odoo/openerp-geven+
  3974  1.5  189.2m  40.9m   3.4m   3.1m   40.9m   2.3m  487    0 S  20   0  0.0 python /opt/openerp/odoo/openerp-server --confi+
  3981  0.2  200.1m  48.1m   0.5m   3.1m   47.9m   0.0m 4340    0 S  30  10  0.0 python /opt/openerp/odoo/openerp-server --confi+
  3982  0.2  189.2m  41.5m   0.4m   3.1m   40.9m   0.0m  880    0 S  30  10  0.0 python /opt/openerp/odoo/openerp-server --confi+

@DocCyblade
Copy link
Owner Author

Did more some testing
VM Specs
1 CPU / 256MB RAM

This is at the end of installing 5 modules and getting ready to print 7 quotes

top - 10:02:18 up 34 min,  1 user,  load average: 0.52, 0.66, 0.35
Tasks: 173 total,   2 running, 171 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  1.7 sy,  0.0 ni, 97.4 id,  0.3 wa,  0.0 hi,  0.3 si,  0.0 st
MiB Mem:   228.977 total,  225.398 used,    3.578 free,    0.859 buffers
MiB Swap:  507.996 total,  432.719 used,   75.277 free.   48.734 cached Mem

   PID %MEM    VIRT   SWAP    RES   CODE    DATA    SHR nMaj nDRT S  PR  NI %CPU COMMAND                                         
  3980 22.3  341.0m  50.6m  51.0m   3.1m  168.9m   3.8m  45k    0 S  20   0  0.0 /usr/bin/python /opt/openerp/odoo/openerp-geven+
  3979  8.5  277.6m  90.7m  19.5m   3.1m  107.8m   1.2m  39k    0 S  20   0  0.0 python /opt/openerp/odoo/openerp-server --confi+
  3978  4.2  295.6m 117.7m   9.6m   3.1m  125.9m   1.2m  99k    0 S  20   0  0.0 python /opt/openerp/odoo/openerp-server --confi+
  3981  3.5  200.1m  44.9m   8.1m   3.1m   47.9m   4.3m 6718    0 S  30  10  0.0 python /opt/openerp/odoo/openerp-server --confi+
  3982  3.5  189.2m  38.4m   8.0m   3.1m   40.9m   4.5m 2538    0 S  30  10  0.0 python /opt/openerp/odoo/openerp-server --confi+
  3974  0.8  189.2m  41.0m   1.7m   3.1m   40.9m   0.8m  809    0 S  20   0  0.0 python /opt/openerp/odoo/openerp-server --confi+

@DocCyblade
Copy link
Owner Author

Did more some testing
VM Specs
1 CPU / 256MB RAM

This at the peak of printing 7 quotes

top - 10:07:49 up 40 min,  1 user,  load average: 0.31, 0.33, 0.29
Tasks: 177 total,   1 running, 176 sleeping,   0 stopped,   0 zombie
%Cpu(s): 24.0 us, 10.3 sy,  0.3 ni, 59.3 id,  3.3 wa,  0.0 hi,  2.7 si,  0.0 st
MiB Mem:   228.977 total,  225.043 used,    3.934 free,    0.477 buffers
MiB Swap:  507.996 total,  462.160 used,   45.836 free.   49.332 cached Mem

   PID %MEM    VIRT   SWAP    RES   CODE    DATA    SHR nMaj nDRT S  PR  NI %CPU COMMAND                                         
  4657 15.6 1284.0m   0.0m  35.7m  35.7m 1189.6m  25.6m   10    0 S  20   0  2.6 /usr/bin/wkhtmltopdf --cookie session_id 8669d6+
  3978 14.9  295.6m  94.6m  34.2m   3.1m  125.9m   2.7m 127k    0 S  20   0  1.0 python /opt/openerp/odoo/openerp-server --confi+
  3979 12.4  276.8m  82.4m  28.3m   3.1m  107.1m   2.5m  66k    0 S  20   0  0.3 python /opt/openerp/odoo/openerp-server --confi+
  3981  3.6  200.1m  44.9m   8.3m   3.1m   47.9m   4.6m 8498    0 S  30  10  1.7 python /opt/openerp/odoo/openerp-server --confi+
  3980  1.3  341.0m  96.6m   2.9m   3.1m  168.9m   1.6m  51k    0 S  20   0  0.0 /usr/bin/python /opt/openerp/odoo/openerp-geven+
  3982  0.5  189.2m  41.5m   1.2m   3.1m   40.9m   0.7m 3758    0 S  30  10  0.0 python /opt/openerp/odoo/openerp-server --confi+

@DocCyblade
Copy link
Owner Author

@JedMeister - In testing above, just loading demo data and a few modules Odoo like memory. Odoo is not light on resources. Link below says 4G for memory and multi processors. This makes the max memory I set to seem small if Odoo

https://www.odoo.com/nl_NL/forum/help-1/question/server-hardware-specification-for-small-setup-62565

@JedMeister
Copy link

I still need to talk with Alon about the thoughts I had re upping the current RAM defaults (x2 - as I mentioned elsewhere).

My thought is that we should give Odoo at least 512; probably more. My understanding is that it's not a recommendation; more of a minimum...

Does that sounds reasonable? Suggestions? Thoughts?

@DocCyblade
Copy link
Owner Author

512 would run but you could overload the system pretty quick with lots of modules and users.

1GB would be better. I saw were they were recommended 4GB

@l-arnold
Copy link
Collaborator

I would say:
Minimum System: 512 mb
Base System: 1 GB
Enterprise 2 GB plus

Could have a Matrix for Number of Users perchance. I think most people using this will start as small business. However, if enterprise wants to take it on they can certainly afford to give more horsepower.

@DocCyblade
Copy link
Owner Author

Remember that the VM can be changed after the fact and anyone installing ISO will be mostly probably on physical hardware.

@DocCyblade DocCyblade added this to the v14-READY milestone Oct 16, 2015
@DocCyblade DocCyblade changed the title Research memory limits in config file Create Memory / Settings Matrix Oct 16, 2015
@DocCyblade DocCyblade self-assigned this Oct 16, 2015
@DocCyblade
Copy link
Owner Author

See #52 (comment) for details on what was found

@DocCyblade DocCyblade mentioned this issue Oct 16, 2015
@l-arnold
Copy link
Collaborator

I feel pretty good about 2 Processors and 2gb Memory
We should look at the Cloud Server Sizes and perhaps Put a Package together around that.

Micro .612 gv and variable ecu (likely too small)
Small (which is generally most affordable w/ some power) gives 1.7 gb and 1 ecu (ie 1 processor)
M3 Medium give 3.75 gb ram and 3 ecu
M1 Medium give 3.75 gb ram and 2 ecu (for More money than M3 Medium above - don't go with that)

Can we have 3 Workers or must the units be even numbered?

My Plan won't let me see the M3 Large Settings which Cost the Same as the C1 below
C1 Medium give 1.75 gb ram and 5 ecu

The Small should be able to Run. About what I am checking now
Medium should be better. Odoo is pretty processor intensive

Cost does not quite double (.044 per hr to .067 and .087 per hr)

@DocCyblade
Copy link
Owner Author

From web site about workers

The recommended --workers value is 2*cores+1, as with gunicorn. You can put it in the config file too, e.g workers=5, haven't you tried that? The same goes with the various --limit-* options, e.g. limit_cpu_time=1200 to limit requests to 20 minutes. The limits apply only when workers > 0

@DocCyblade
Copy link
Owner Author

Just to be clear:

  1. the --workers is how many new process will be started to perform work (answer requests)
  2. The above workers have limits upon them set by the max_memory settings.
  3. The "soft" limit is the amount of ram that when a process goes over this limit after it is done with the request it is terminated and the memory it was using is freed. This amount goes for each process
  4. The hard limit is the amount of ram that if the process goes over it, it WILL terminate right then. (I don't think this is really correct because of the PDF issue we had and set this to 1.3 GB and never saw a process take this much. but if its below 1.3GB PDF are not created)

The one we need to pay attention to is the soft limit. As these workers will stay alive and hold on to memory until that limit is reached. So if you have 5 workers and the soft limit is 256MB you could end up with 5 workers each taking 256MB that's 1.25GB of RAM that could be taken up. If you only had 1GB of ram you may need to dial back your workers or your soft limit.

It's a balancing act of sorts, I am also not sure if keeping the processors at say 350 or 400 if there is some caching effect. Not sure why it's holding on to the memory.

If the math on the workers is (cores * 2 + 1) then a soft memory limit may be something like

M = Total memory in bytes (1048576 = 1MB)
W = Workers (`workers` )
CW = Cron workers (`max_cron_threads`)
TW = W + CW

For ram 512-1GB
((TW * 0.45 ) + TW) / M = limit_soft_memory

1GB - 2GB
(TW * 0.40 ) + (TW - 1) / M = limit_soft_memory

2GB - 4GB
(TW * 0.35 ) + (TW - 1) / M = limit_soft_memory

4GB - 8GB
(TW * 0.30 ) + (TW - 2) / M = limit_soft_memory

8GB + 12GB
(TW * 0.25 ) + (TW - 3) / M = limit_soft_memory

12GB +
(TW * 0.15 ) + (TW - 3) / M = limit_soft_memory

Just remember that the process can go beyond the soft limit, it's just once the request is over it give up it's memory. So if you have a lot of workers (multi-people hitting the server) there is a good chance the workers could go over the soft limit, however it will free up memory when it's done with the request.

@DocCyblade
Copy link
Owner Author

@JedMeister - Your thoughts on the subject

@l-arnold
Copy link
Collaborator

Let me work through those numbers. I had not jumped passed 4 gb and a algorithm does make sense.

@JedMeister
Copy link

And soft_limit is in bytes? I.e. MB * ~1048576 right?

Perhaps we could actually add some comments to this effect in the /etc/openerp.conf? Plus document as well...

Otherwise sounds all good to me.. 😄

@DocCyblade
Copy link
Owner Author

Yes in bytes

And yes I was planning on doing some documentation in the config file

@DocCyblade
Copy link
Owner Author

I propose the following:


A word on tuning your TurnkKey Linux Odoo Server

A lot of time has gone in to testing this TKL appliance, and one thing we
learned while testing was tuning. For all the why we chose these numbers you
can take a look at he issues on GitHub (links at the botton of this article)

Most of this text here was taken from the Memory Matrix Discussion
#49 (comment)

It is important to note that you can run Odoo in threaded mode by setting
the workers option to 0 however there are some modules that won't work
and you loose fine grain control of resource management.


the --workers is how many new process will be started to perform work or
(answer requests) The workers have limits upon them set by the limit_xxxxx
options here in the config file.

The "limit_memory_soft" limit is the amount of ram that when a process
goes over this limit after it is done with the request it is terminated
and the memory it was using is freed. This amount goes for each process

The hard limit is the amount of ram that if the process goes over it,
it WILL terminate right then. (I don't think this is really correct
because of the PDF issue we had and set this to 1.3 GB and never
saw a process take this much. but if its below 1.3GB PDF are not created)

The one we need to pay attention to is the limit_memory_soft.
As these workers will stay alive and hold on to memory until that limit
is reached. So if you have 5 workers and the soft limit is 256MB you could
end up with 5 workers each taking 256MB that's 1.25GB of RAM that could
be taken up. If you only had 1GB of ram you may need to dial back your
workers or your soft limit.

It's a balancing act of sorts, I am also not sure if keeping the
workers at say 350 or 400 if there is some caching effect. Not sure
why it's holding on to the memory.


Hardware Matrix for recommended values:
(Note these are for REAL hardware, Virtual Hardware has it's own
issues that can arise with too many guest on a host with too many
CPU cores etc, so remember that when looking at the chart below)
(One other note that when I tested these, I did use VMware but
no other VMs where competing for resources)
(One last note, really. These numbers are to show the relationship
between the config settings and hardware. We also assume you are running
the database server on the same server. I know at some point in the
higher numbers that this would not be the case. These are not numbers
set in stone nor numbers gotten from Odoo. These are numbers I have
come up with from the testing I have done. Real world examples if you
have them would be great and these numbers can and should be updated!

Heading Description
CPUs Number of CPU Cores not threads
Physical Physical memory, not virtual or swap
workers Number of workers specified in config file (workers = x)
cron Number of workers for cron jobs (max_cron_threads = xx)
Mem Per Memory in MB that is the max memory for request per worker
Max Mem Maximum amount that can be used by all workers
limit_memory_soft Number in bytes that you will use for this setting

Note: Max Memory if notice is less than total memory this is on purpose. As
workers process requests they can grow beyond the Mem Per limit so a
server under heavy load could go past this amount. This is why there
is "head room" built in.

CPUs Physical workers cron Mem Per Max Mem limit_memory_soft
ANY =< 256MB NR NR NR NR NR
1 512MB 0 N/A N/A N/A N/A
1 512MB 1 1 177MB 354MB 185127901
1 1GB 2 1 244MB 732MB 255652815
1 2GB 2 1 506MB 1518MB 530242876
2 1GB 3 1 183MB 732MB 191739611
2 2GB 5 2 217MB 1519MB 227246947
2 4GB 5 2 450MB 3150MB 471974428
4 2GB 5 2 217MB 1519MB 227246947
4 4GB 9 2 286MB 3146MB 300347363
4 8GB 9 3 546MB 6552MB 572662306
4 16GB 9 3 1187MB 14244MB 1244918057
6 12GB 10 4 763MB 10682MB 800304465
6 16GB 13 4 838MB 14246MB 878765687
6 32GB 13 4 1676MB 28492MB 81757531374
8 32GB 17 5 1295MB 28490MB 1358092426
8 64GB 17 5 2590MB 56980MB 2716184851

Calculations on how we got the above chart

M = Total memory in bytes (1048576 = 1MB)
W = Workers (workers )
CW = Cron workers (max_cron_threads)
TW = W + CW

For ram 512 to 999MB
((TW * 0.45 ) + TW) / M = limit_soft_memory

1GB - 1.99GB
(TW * 0.40 ) + (TW - 1) / M = limit_soft_memory

2GB - 3.99GB
(TW * 0.35 ) + (TW - 1) / M = limit_soft_memory

4GB - 7.99GB
(TW * 0.30 ) + (TW - 2) / M = limit_soft_memory

8GB + 11.99GB
(TW * 0.25 ) + (TW - 3) / M = limit_soft_memory

12GB +
(TW * 0.15 ) + (TW - 3) / M = limit_soft_memory

Memory Matrix Discussion
#49

Shakedown Testing Discussions
#52
#53
#54
#55

@DocCyblade
Copy link
Owner Author

Will use the above values in the docs

@l-arnold
Copy link
Collaborator

Sounds good Ken.
What should be stated about "hard limit" with this?
I have been going off of 75% of the amount of Ram on the System.

@DocCyblade
Copy link
Owner Author

I set it to the smallest we could that the pdf still worked

@DocCyblade
Copy link
Owner Author

Regarding the limit_memory_hard option and why it seems to need at least 1.3G see #62 (comment)

@JedMeister
Copy link

Looks great! 👍

@pambudisatria
Copy link

@DocCyblade I still don't get it.
Could you please explain about your formula to get limit_memory_soft
for example:

CPUs Physical workers cron Mem Per Max Mem limit_memory_soft
8 32GB 17 5 1295MB 28490MB 1358092426

M = 33554432000
W = 17
CW = 5
TW = 22

12GB +
(TW * 0.15 ) + (TW - 3) / M = limit_memory_soft
(22 * 0.15) +(22 - 3) / 33554432000 = 1358092426 ?

@l-arnold
Copy link
Collaborator

This, I recall, was based upon Odoo Requirements, and DocCyBlade's calculations and my testing as to what is required memory wise to be able to Print PDF documents in Odoo 8.0 TurnkeyLinux build. There is more to Odoo than PDF printing but it was a real hurdle to get over from several points.

A few Odoo links (not read in detail today) are below:

https://www.odoo.com/forum/help-1/question/reduce-memory-usage-54636

https://www.rosehosting.com/blog/how-to-speed-up-odoo/

https://stackoverflow.com/questions/41361358/how-to-increase-the-default-memory-usage-in-odoo

@m3asmi
Copy link

m3asmi commented Mar 18, 2020

@DocCyblade I still don't get it.
Could you please explain about your formula to get limit_memory_soft
for example:
CPUs Physical workers cron Mem Per Max Mem limit_memory_soft
8 32GB 17 5 1295MB 28490MB 1358092426

M = 33554432000
W = 17
CW = 5
TW = 22

12GB +
(TW * 0.15 ) + (TW - 3) / M = limit_memory_soft
(22 * 0.15) +(22 - 3) / 33554432000 = 1358092426 ?

@DocCyblade can you please explain ?

@l-arnold
Copy link
Collaborator

What this points to is that the Server, ideally, is configured based upon the workload put to it. It is a common problem with Turnkey Apps that Memory settings get fixed by the install when the install can often accommodate much larger allocations to different processes.

In the Odoo situation, at a minimum, if you wanted to be able to generate a PDF invoice and email to your customer (pretty much the point of a ERP system) you need a certain amount of memory. If you had "workers" out there synchronizing with different APIs, you need memory allocated to those purposes.

This was well explained back when the first TKL Odoo App was created. I fear that the documentation of it was removed in the "stripping" that tends to occur.

I will look to see if I can find the full explanation.

@l-arnold
Copy link
Collaborator

Doc's Post (directly above) from Oct 17, 2015 is pretty complete. Still more discussion, particularly in relation to the current build should take place. Odoo may have changed some pretty key elements. Workers for instance may be Jobs now (or vis a versa) but using different memory calls.

Doc Wrote there:
"the --workers is how many new process will be started to perform work or
(answer requests) The workers have limits upon them set by the limit_xxxxx
options here in the config file.

The "limit_memory_soft" limit is the amount of ram that when a process
goes over this limit after it is done with the request it is terminated
and the memory it was using is freed. This amount goes for each process

The hard limit is the amount of ram that if the process goes over it,
it WILL terminate right then. (I don't think this is really correct
because of the PDF issue we had and set this to 1.3 GB and never
saw a process take this much. but if its below 1.3GB PDF are not created)

The one we need to pay attention to is the limit_memory_soft.
As these workers will stay alive and hold on to memory until that limit
is reached. So if you have 5 workers and the soft limit is 256MB you cou"ld
end up with 5 workers each taking 256MB that's 1.25GB of RAM that could
be taken up. If you only had 1GB of ram you may need to dial back your
workers or your soft limit."

@m3asmi
Copy link

m3asmi commented Mar 22, 2020

@l-arnold thank you for the explanation, I would like to know how @DocCyblade got the values in the table above. I may miss something as @pambudisatria said here the values are different ?!

CPUs Physical workers cron Mem Per Max Mem limit_memory_soft
8 32GB 17 5 1295MB 28490MB 1358092426

M = 33554432000
W = 17
CW = 5
TW = 22

12GB +
(TW * 0.15 ) + (TW - 3) / M = limit_memory_soft
(22 * 0.15) +(22 - 3) / 33554432000 = 1358092426 ?

@kevinimbrechts
Copy link

@l-arnold thank you for the explanation, I would like to know how @DocCyblade got the values in the table above. I may miss something as @pambudisatria said here the values are different ?!

CPUs Physical workers cron Mem Per Max Mem limit_memory_soft
8 32GB 17 5 1295MB 28490MB 1358092426

M = 33554432000
W = 17
CW = 5
TW = 22

12GB +
(TW * 0.15 ) + (TW - 3) / M = limit_memory_soft
(22 * 0.15) +(22 - 3) / 33554432000 = 1358092426 ?

Hi all,
I also don't understand how @DocCyblade finds this limit. Have you found since last year @m3asmi ?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants