ERP system performance is crucial for smooth business processes. Odoo, as a comprehensive solution, requires proper configuration to work optimally. In this article, we'll present proven methods for optimizing Odoo performance that will help you maximize the system's potential.
Want to see how fast a well-configured system can be?
Why is Odoo performance optimization so important?
A slow ERP system is not just user frustration, but primarily real business losses. Delays in processing orders, slow report generation, or freezing forms can cost a company thousands of dollars daily. Odoo performance optimization enables smooth operation of all modules, faster data processing, and better user experience. A well-configured system can handle several times more concurrent users without losing responsiveness.
Workers Configuration - Foundation of Performance
One of the most important steps in optimizing Odoo performance is proper configuration of worker processes. Workers are processes responsible for handling user requests. By default, Odoo runs in single-threaded mode (without workers), which is sufficient only for small test installations with one user.
How to determine the optimal number of workers?
The number of workers should be adjusted to the server's hardware specifications. The general rule states that the number of workers should be (number_of_CPU_cores * 2) + 1. For example, for a server with 4 cores, the optimal number is 9 workers. Equally important is configuring memory limits: limit_memory_hard defines the maximum virtual memory (worker is killed when exceeded), and limit_memory_soft defines the memory limit after which the worker is restarted after completing the request. For a typical installation, recommended values are limit_memory_hard = 2684354560 (2.5GB) and limit_memory_soft = 2147483648 (2GB) per worker. Remember that total RAM consumption = (workers * limit_memory_hard) + PostgreSQL memory + system, so the server must have sufficient RAM.
You can find a detailed configuration guide in the article: How to Configure Odoo with Multiple Workers?
PostgreSQL Database Optimization
The database is the heart of every Odoo system. Its performance directly affects the speed of the entire system. PostgreSQL requires regular maintenance and proper configuration to work optimally.
Database Indexes
Proper indexes significantly speed up query execution. Odoo automatically creates basic indexes on primary keys, foreign keys, and fields with the index=True attribute. For custom modules or specific queries, it's worth considering adding custom indexes on frequently used fields in filters, searches, and groupings. Use pg_stat_statements or pgBadger to identify slow queries requiring indexing.
PostgreSQL Parameters
Adjusting postgresql.conf parameters to available resources can significantly improve performance. Key parameters are: shared_buffers (25% of server RAM, e.g., 4GB for 16GB RAM), effective_cache_size (50-75% of RAM, e.g., 10GB for 16GB RAM), work_mem (RAM/number_of_connections/2, e.g., 32MB), and maintenance_work_mem (512MB-2GB for maintenance operations). Also increase max_connections to a value greater than the number of workers (e.g., 200). For Odoo, the parameter checkpoint_completion_target = 0.9 is also recommended for smoother writes. Remember regular backups - more information here: How to set up automatic backups in Odoo?
Database Maintenance
PostgreSQL has an autovacuum mechanism that automatically removes dead rows and updates planner statistics. Make sure autovacuum is enabled (which is the default). Regular manual ANALYZE (e.g., weekly) updates statistics and helps the planner choose optimal query plans. VACUUM FULL is needed very rarely and locks the entire table, so avoid it in production - instead, configure autovacuum_vacuum_scale_factor appropriately.
Using Cache Mechanisms
Odoo has a built-in multi-level cache system that automatically caches model metadata, permissions, translations, and many other data. Since Odoo 16, the cache system works efficiently without external tools for most installations.
Redis or Memcached for Sessions
For larger installations with multiple workers, it's worth considering using Redis or Memcached to store user sessions. By default, sessions are stored in the PostgreSQL database, which generates additional queries. Redis allows faster access to sessions and can be shared between multiple Odoo servers in distributed installations. Configuration requires setting the session_store parameter in the Odoo configuration file.
Implementing advanced cache mechanisms requires technical experience.
Static Assets Cache
Enabling production mode (without the --dev parameter) automatically activates bundling and minification of static assets (CSS, JavaScript). Files are automatically combined, compressed, and cached with a long expiration time. Make sure the --dev parameter is not active in the production environment, as it disables cache and forces asset rebuilding with each request, significantly slowing down the system. After updating modules, it's worth running odoo-bin --update=all to rebuild assets.
Code and Customization Optimization
Custom modules are often a source of performance issues. When creating your own extensions, pay attention to:
- Avoiding loops within loops when processing records - use recordset operations instead of iteration
- Using batch processing methods for mass operations - create(), write(), and unlink() methods handle multiple records simultaneously
- Minimizing search() and browse() calls - fetch all needed data at once
- Using computed fields with proper store=True and depends for frequently read fields
- Avoiding excessive inheritance and method overriding - each inheritance layer adds overhead
- Using search_count() instead of len(search()) when only the record count is needed
- Using prefetch_fields context to control prefetching of related records
Developer Mode vs Performance
Odoo has two mechanisms for developers: developer mode (enabled through menu) and the --dev startup parameter. Developer Mode enabled through the interface adds technical features, metadata view, and debugging options - it has minimal impact on performance and can be used in production if needed. However, the --dev=all startup parameter disables cache, forces Python reload with every change, disables JS/CSS minification, and significantly slows down the system - it should never be active in production. Learn more: How to enable developer mode in Odoo? 4 proven methods
Performance Monitoring and Analysis
Regular monitoring allows you to detect problems before they become critical. Use Odoo's built-in tools as well as external monitoring solutions.
Monitoring Tools
Odoo has built-in performance analysis tools. In developer mode, a profiler is available that shows a detailed breakdown of execution time for each request - SQL queries, view rendering, Python calculations. You can activate it through the debug icons in the upper right corner. For long-term monitoring, check Odoo logs (especially with log_level=debug_sql set) to see slow queries. External tools like Prometheus with Grafana, pgBadger for PostgreSQL, or pg_stat_statements provide even more detailed information and allow alerting when problems occur.
Key Metrics to Monitor
Track regularly: system response time, CPU and RAM usage, number of active database connections, worker queue length, execution time of slowest SQL queries, and database size. Set alerts when thresholds are exceeded to react proactively.
Want to see all system capabilities in practice?
Server Infrastructure Optimization
Hardware is fundamental to Odoo performance. Key elements are:
- CPU: High clock frequency is more important than the number of cores - Odoo performs better on 4 cores at 3.5GHz than on 8 cores at 2.0GHz
- RAM: Minimum 8GB for testing, but 16GB is a realistic minimum for production with 10-20 users, 32-64GB for larger installations
- Disk: SSD (preferably NVMe) instead of HDD can speed up the system by even 300-500% - this is one of the most cost-effective investments
- Network: Low latency (below 10ms), especially important for distributed installations and when the database is on a separate server
Service Separation
For larger installations (50+ users), consider separating PostgreSQL database, Odoo application server, and file server on separate machines. This allows independent scaling of each component and better resource utilization. You can also consider load balancing with multiple Odoo servers behind a reverse proxy (nginx). Alternatively, consider Odoo.sh - managed hosting from Odoo creators with automatic optimization, scaling, and backups.
Attachment and File Management
Since Odoo version 11, the system stores attachments in the file system (filestore) by default instead of in the database, which significantly improves performance. Make sure the data_dir parameter is properly configured and points to a fast disk (preferably SSD). Attachments are stored in the filestore subdirectory with deduplication (the same file stored multiple times takes up space only once).
Cleaning Unused Data
Regularly review and archive old records that are no longer actively used - Odoo supports archiving (active=False) for most models. Set a retention policy for system logs, emails, chat messages, and old attachments. You can use Scheduled Actions to automatically clean up. Pay special attention to the mail.mail and mail.message models, which can grow quickly. For messages older than 6-12 months, consider deletion or moving to an archive.
View and Report Optimization
Complex views with many computed fields and related fields can significantly slow down the system. Optimize views by:
- Limiting the number of visible columns in list views (tree view) - show only the most important information
- Using pagination instead of loading all records - the default limit is 80 records per page
- Optimizing domain and context - avoid complex calculations in domain
- Lazy loading of relational fields - Odoo uses prefetching by default, but you can control it through context
- Avoiding computed fields without store=True in list views - each displayed record requires calculation
- Using the optional='hide' or optional='show' attribute for columns that users can enable as needed
Report Optimization
PDF reports, especially those generated by QWeb, can be slow for large documents. Optimize by: simplifying QWeb templates (fewer loops and conditions), avoiding generating very large reports synchronously (use queues for reports >100 pages), caching data before rendering instead of multiple queries in the template, and considering generating reports in the background with email notification upon completion for very large documents.
FAQ - Frequently Asked Questions
How many workers should I configure for my Odoo server?
The optimal number of workers depends on the number of CPU cores. The general formula is (number_of_cores * 2) + 1. For a server with 4 cores, we recommend 9 workers. Also remember proper memory limit configuration for each worker: limit_memory_hard = 2684354560 (2.5GB) and limit_memory_soft = 2147483648 (2GB). Make sure the server has enough RAM: workers * 2.5GB + 4GB for PostgreSQL + 2GB for the system. Details can be found in the article about multiple workers configuration.
Does an SSD really make a difference in Odoo performance?
Yes, the difference is huge and it's one of the most cost-effective investments. An SSD (especially NVMe) can speed up Odoo by even 300-500% compared to traditional HDD drives. This is particularly noticeable during: database operations (INSERT, UPDATE, SELECT with JOIN), module loading at server startup, PDF report generation, database backups and restore, and working with attachments. For a production server, an SSD is an absolute minimum.
How often should I run VACUUM on the PostgreSQL database?
PostgreSQL runs autovacuum automatically in the background and for most installations this is completely sufficient. Make sure autovacuum is enabled (check in postgresql.conf). You can tune the autovacuum_vacuum_scale_factor (default 0.2) and autovacuum_analyze_scale_factor (default 0.1) parameters for more frequent execution on large tables. Manual VACUUM (without FULL) can be run weekly to be safe, preferably during nighttime hours - it doesn't lock the table. VACUUM FULL locks the entire table and is needed very rarely (only when a table has >50% dead rows) - avoid it in production. Regular ANALYZE (weekly) updates planner statistics and is always safe.
Do I need Redis for my Odoo installation?
For small and medium installations (up to 50 users, single server) Redis is not necessary - Odoo's built-in cache system works well enough. Redis becomes useful when: you have a distributed installation with multiple Odoo servers (Redis allows sharing session cache), you have a very large number of concurrent users (Redis handles sessions faster than PostgreSQL), or you need advanced caching for custom modules. Remember that Redis requires additional configuration and maintenance.
Summary
Odoo performance optimization is an ongoing process requiring regular monitoring and adjustment. Key areas are: proper workers configuration with appropriate memory limits, PostgreSQL database optimization (indexes, parameters, maintenance), using built-in cache mechanisms and optionally Redis for large installations, quality of custom module code (avoiding loops, batch processing, store=True for computed fields), appropriate server infrastructure (SSD!, sufficient RAM, good CPU), and regular cleaning of unused data. Implementing the presented methods can improve system speed several times over and allow handling significantly more concurrent users.
Need help optimizing your Odoo installation or a performance audit? Our team of experts at KK Innovations will help you configure the system for maximum performance.