Comprehensive Guide to Optimizing Odoo 13 Enterprise Configuration
Maximize Performance on Your Linode Dedicated CPU 8GB Plan
Key Takeaways
- Optimal Worker Count: Calculate workers using the formula
(CPU cores * 2) + 1to balance load and performance. - Memory Allocation: Allocate memory per worker thoughtfully, setting both soft and hard limits to prevent resource exhaustion.
- Efficient Resource Management: Implement robust timeout settings and database connection pooling to ensure stability and responsiveness.
Introduction
Optimizing the Odoo 13 Enterprise configuration is crucial for ensuring optimal performance, especially when hosted on a Dedicated CPU 8GB plan from Linode (now Akamai). This comprehensive guide focuses on key areas such as worker configuration, memory limits, and other performance-related settings to help you achieve a stable and efficient Odoo environment.
Workers Configuration
Determining the Number of Workers
The number of workers is a critical factor in handling concurrent user requests efficiently. The general formula for calculating the optimal number of workers is:
workers = (CPU cores * 2) + 1
For a Dedicated CPU plan with 4 CPU cores:
workers = (4 * 2) + 1 = 9
Setting the workers to 9 ensures that the system can handle approximately 54 concurrent users (assuming each worker handles about 6 users).
Configuring Worker Types
Odoo supports different worker types. The prefork model is recommended for production environments due to its stability.
Example configuration:
worker_type = prefork
workers = 9
Longpolling Workers
Dedicated longpolling workers handle real-time features like live chat. It's advisable to allocate at least one dedicated worker for longpolling:
longpolling_port = 8072
Ensure that the total number of workers, including longpolling workers, does not exceed system capacity.
Memory Allocation
Memory per Worker
Proper memory allocation per worker is essential to prevent resource exhaustion and ensure smooth operation. For an 8GB server:
- Reserve 1GB for the system and PostgreSQL.
- Allocate the remaining 7GB for Odoo workers.
Thus, each worker can be allocated approximately 1GB of memory.
Setting Memory Limits
Configuring both soft and hard memory limits allows workers to manage memory usage gracefully:
- Limit Memory Soft: This setting allows workers to use memory up to a certain threshold before they are gracefully restarted.
- Limit Memory Hard: This acts as a safeguard to prevent workers from consuming excessive memory, enforcing a hard limit.
Recommended settings:
limit_memory_soft = 1073741824 # 1GB
limit_memory_hard = 1610612736 # 1.5GB
Example Memory Configuration
Here’s how you can configure memory settings in your odoo.conf file:
[options]
workers = 9
limit_memory_soft = 1073741824
limit_memory_hard = 1610612736
Timeout Settings
Configuring Request Timeouts
Setting appropriate timeout values ensures that long-running tasks do not block workers indefinitely, maintaining system responsiveness.
- CPU Time Limit: Defines the maximum CPU time a request can consume.
- Real Time Limit: Sets the maximum real-world time a request is allowed.
Recommended settings:
limit_time_cpu = 600 # 10 minutes
limit_time_real = 1200 # 20 minutes
Example Timeout Configuration
[options]
limit_time_cpu = 600
limit_time_real = 1200
Database Connection Pooling
Managing Database Connections
To prevent overloading the PostgreSQL database, it's crucial to set an appropriate limit on the number of database connections:
Formula: db_maxconn = workers * 7
For 9 workers:
db_maxconn = 64
This ensures that the database can handle the number of concurrent connections without becoming a bottleneck.
Example Database Configuration
[options]
db_maxconn = 64
Logging and Debugging
Optimizing Log Settings
Efficient logging helps in monitoring system performance without introducing unnecessary overhead:
- Disable Debug Mode: Ensure that
debug_modeis set toFalsein production to prevent verbose logging. - Set Appropriate Log Level: Use
warnorerrorto keep log files concise and focused on critical issues.
Recommended settings:
debug_mode = False
log_level = warn
Example Logging Configuration
[options]
debug_mode = False
log_level = warn
File Storage Optimization
Managing Filestore Directory
If your Odoo instance uses filestore for storing attachments and other files, it's essential to optimize and regularly clean the storage directory to prevent excessive disk usage:
-
Ensure that the filestore directory is located on a disk with sufficient space.
-
Implement regular maintenance tasks to clean up unused files.
Example Configuration File
Consolidated Settings
Below is an example of an optimized odoo.conf file incorporating the recommended settings:
[options]
workers = 9
worker_type = prefork
max_cron_threads = 1
limit_memory_soft = 1073741824
limit_memory_hard = 1610612736
limit_time_cpu = 600
limit_time_real = 1200
db_maxconn = 64
debug_mode = False
log_level = warn
longpolling_port = 8072
limit_request = 8192
logfile = /var/log/odoo/odoo.log
proxy_mode = True
Implementing the Configuration
Steps to Apply Optimizations
Edit the
odoo.conffile, typically located at/etc/odoo/odoo.confor the directory where your Odoo instance is deployed.Apply the recommended settings as outlined in the example configuration above.
Restart the Odoo service to apply the changes:
sudo systemctl restart odoo13Monitor the system’s performance and adjust settings as necessary based on actual usage patterns.
Monitoring and Fine-Tuning
Performance Monitoring Tools
Utilize monitoring tools to keep track of system performance metrics such as CPU usage, memory consumption, and database performance. Tools like Prometheus and Grafana can provide valuable insights.
Adjusting Configurations Based on Load
Based on the monitored data, you may need to adjust the number of workers, memory limits, or other settings to better suit your specific workload and usage patterns.
Conclusion
Optimizing the Odoo 13 Enterprise configuration on a Dedicated CPU 8GB Linode plan involves carefully balancing worker processes, memory allocation, and other resource settings. By following the guidelines outlined in this comprehensive guide, you can ensure that your Odoo instance operates efficiently, remains stable under load, and provides a seamless experience for your users.
References
Last updated January 23, 2025