Why it happens
The Odoo server can freeze or return 500 errors due to an incorrect configuration of the Workers and memory parameters in the
odoo.conf file. This is especially common when multiple users run intensive tasks such as generating large invoices, PDF reports, or bulk inventory processes. If the memory limits (
limit_memory_hard and
limit_memory_soft) are set too low or the Workers haven't been properly defined, the system can quickly become overloaded.The reporting engine
Wkhtmltopdf and the Python interpreter are particularly resource-intensive. Without proper configuration, Odoo can run out of available memory or overload the CPU, resulting in intermittent service outages.
How to calculate the ideal number of Workers
The optimal number of Workers depends on the number of CPU cores available on your server. A general rule is to assign one Worker per core, plus one additional Worker for background tasks. For example:
- If you have a server with 4 cores, configure 5 Workers.
- For a server with 8 cores, configure 9 Workers.
This approach ensures a balance between system performance and stability.
Steps to adjust the memory limits and execution time
1. Edit the odoo.conf file
Locate and open Odoo's configuration file, usually located at
/etc/odoo/odoo.conf. Add or modify the following parameters:
workers = 5
limit_memory_hard = 1677721600
limit_memory_soft = 1342177280
limit_time_cpu = 600
limit_time_real = 1200
These values are indicative and should be adjusted according to your server's resources. For example:
workers: Defines the number of concurrent processes.limit_memory_hard: Sets the maximum memory limit per Worker (in bytes).limit_memory_soft: Defines the recommended memory limit.limit_time_cpu and limit_time_real: Control the maximum execution time of tasks (in seconds).
2. Restart the Odoo service
Save the changes and restart the service to apply the new configuration:
sudo service odoo restart
3. Validate performance
Monitor Odoo's logs in real time to ensure the system is operating correctly:
sudo tail -f /var/log/odoo/odoo.log
Look for error messages or warnings indicating memory or execution time issues.
Frequently asked questions
What happens if I don’t configure the Workers in Odoo?
If you don't define the Workers, Odoo will use a single process to handle all requests, which can quickly overload the server when facing multiple users or intensive tasks.
How do I know if the memory limits are adequate?
Monitor the server's memory usage with tools like
top or
htop. If you see that memory is running out or is close to the limit, increase the values of
limit_memory_hard and
limit_memory_soft.
What happens if I exceed limit_time_cpu or limit_time_real?
If a task exceeds these limits, Odoo will automatically cancel it to prevent overloading the system. This can generate errors in long-running tasks, so it's important to adjust these values according to the type of operations you run.