How to make Odoo Faster

Hello there, if your Odoo server is slow despite having a lot of available RAM and Processing power this tutorial is for you.

Today we will learn to to make some hardware optimizations to make Odoo as fast as possible, to do that we need to edit Odoo configuration file usually it’s under the following location, make sure to open the file with root user:

sudo nano /etc/odoo/odoo.conf

Before we edit the file, let’s talk about how much resources you have for Odoo, and to do this we will assume that you have Postgres and Odoo on the same server with the following resources: 

4 GB of RAM
4 VCPU

In this case we will set half of the resources to be used by Odoo while keeping the other half for Postgres engine and the operating system, so now we only have: 

2 GB of RAM
2 VCPU

Reserved for Odoo.


 Now we will calculate some values and put them in the configuration file, lets start with, Estimated number of workers and we will use the following formula:

Estimated number of worker = (vcpus * 2) + 1 
# in our case the value should be 2*2+1=5 workers


Every worker can serve up to 2 concurrent users, so with the current workers value we can serve 10 concurrent users (5 * 2).

Next we should calculate Estimated RAM usage by Odoo and to do this we will assume that Odoo will serve 30% long queries and 70% short queries, let’s have a look at the formula:

Estimated RAM usage = workers * ((0.7*300) + (0.3*1024)) with
# (0.7*0.3) means (70%)short queries will only need 300 MB of RAM
# (0.3*1) means (30%) of long queries will need about 1024 MB of RAMEstimated RAM usage = 5 * (210+307) = 5 * 517 = 2585 MB ~= 2.5GB

We can see that the value we got is close to our reserved RAM for Odoo, so now let’s go ahead and update the configuration file by adding those lines: 

limit_memory_hard = 2684354560 #should be 2.5 GB
limit_memory_soft = 2147483648 #should be 2 GB
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 5

Make sure to convert the values from GB to Bytes, you can use this online tool for that.

Now make sure to close the file with Ctrl+x then y, and Restart Odoo, and enjoy a faster server!





in Odoo