Enable Dark Mode!
how-to-optimize-an-odoo-server-postgresql.jpg
By: Afra k

How to Optimize an Odoo Server & PostgreSQL

Technical

Odoo is one of the most popular Enterprise Resource Planning (ERP) software and, it is a suite of open-source business apps that cover all our company needs like Accounting, CRM, Inventory, Point of sale, Project management, etc. 

Here we discuss how to optimize the server for the best Odoo performance 

To Set Worker and Memory Limits for Odoo

Open the configuration file of your Odoo instance:

nano /etc/odoo-live.conf

Set the following fields:

workers - The number of workers should be equal to the number of CPU cores allocated to the VPS, or (CPU CORES * 2) + 1 (e.g.13 workers for 6 CPU CORES ).  Set the value lower, If we need to give the CPU resources for other processes. 

limit_time_CPU - It is the maximum allowed CPU time per request.

limit_memory_hard - It is the maximum permitted virtual memory per worker, when it is reached, any memory allocation will fail.

limit_memory_soft - It is the maximum permitted virtual memory per worker, when it is reached the worker is to be reset after the current request.

limit_time_CPU - It is the maximum allowed CPU time per request.

limit_time_real - It is the maximum allowed Real time per request.

limit_request - It is the maximum number of requests to be processed per worker.

While setting memory limits, it also takes other applications into account. The combined formula should be (Total RAM - RAM for other apps) / Number of workers.

For example, in a system with 6 CPU cores and 16GB of RAM, the settings would be as follows:

workers = 13
limit_memory_hard = 1208MB
limit_memory_soft = 1024MB

Then Restart the Odoo:

sudo service odoo-live restart

PostgreSQL Performance Tuning

The first step in PostgreSQL performance tuning is to set up the database correctly.

In every table, while we add and run every query, the databases will require updates and maintenance to ensure the ideal PostgreSQL optimization.

PostgreSQL optimization is rather clear, however, PostgreSQL needs some things from the database admin to run effectively.

While PostgreSQL performance tuning an application, It starts by implementing the schema and database and doesn’t optimize it early. Then we can start to monitor the SQL queries with the tools like retrace etc when we have got the optimal setup. PostgreSQL performance tuning is all about the trade-offs, so it is an important thing.

Here we go through the different types of PostgreSQL optimizations.

Hardware Updates: We can make the changes to the physical server

Configuration: The changes in the PostgreSQL configurations

Vacuuming: The different ways in which the vacuum setting can improve.

These are some of the basic setup options available that we need to go through first.

Once the system is set up, Then we can see how we can analyze and improve the schema

Analyze the query performance: How to analyze individual queries

Analyze the logs: How to get the information to analyze the system

Index for query performance: How the database optimizes its query plan helps when adding the indexes, 

Optimize the Buffer and Cache Size of PostgreSQL

For the PostgreSQL optimization, we need to update to the latest PostgreSQL version.

Open the configuration file of the PostgreSQL installation:

/var/lib/postgresql/data/postgresql.conf

Set the following fields:

Shared buffers - It is the amount of RAM for the PostgreSQL to use and it should be equal to (TOTAL RAM * 0.2).

Effective cache size - It is the amount of disk space in the PostgreSQL cache and it should be equal to the (TOTAL RAM * 0.5).

For better performance of Odoo and PostgreSQL, we can maximize the speed of RAM, CPU, and I/O and, Also maximize the speed and number of cores to help to improve the performance and, then update to the latest PostgreSQL version whenever the latest version of PostgreSQL comes out.

Have a look at the following blog to explore more about Odoo 16 Postgres Version. Odoo 16 Postgres Version


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message