Table of Contents

Common Performance Issues

Before initiating any optimization efforts, it's crucial to identify the indicators of suboptimal Odoo performance. The following are the most prevalent issues suggesting that your Odoo instance requires fine-tuning to enhance its efficiency and user experience:

Slow Page Loads

Pages consistently taking more than 3 seconds to load, particularly impacting list views and dashboards, can significantly hinder user productivity and lead to frustration. Addressing these delays is fundamental for a responsive system.

Report Timeouts

PDF reports and data exports that either time out or require several minutes to generate indicate underlying performance problems, often related to database queries or server processing capabilities. This can disrupt critical business operations.

High CPU Usage

If your server's CPU consistently operates above 80% utilization, it will inevitably lead to system-wide slowdowns, reduced responsiveness, and can impact all users simultaneously. This often points to inefficient code or insufficient processing power.

Memory Exhaustion

Workers being terminated due to exceeding memory limits result in failed requests and service interruptions for users. This indicates that the Odoo processes are consuming more RAM than allocated, often due to large datasets or memory leaks.

Database Lock Contention

When concurrent database operations frequently block each other, it can lead to timeouts and degraded application performance. This contention arises when multiple processes try to modify the same data simultaneously, leading to delays and potential deadlocks.

Slow Search Operations

Search and filter functions that take an excessive amount of time to complete directly impact user experience and efficiency. This issue often points to missing or inefficient database indexes, or poorly optimized search queries.

Diagnosing Bottlenecks

Prior to implementing any optimizations, it is essential to pinpoint the exact locations of performance bottlenecks within your Odoo environment. Here are the recommended diagnostic procedures. If you are specifically experiencing sluggishness with Odoo.sh, we recommend reviewing our dedicated guide on resolving slow Odoo.sh performance, which offers tailored advice for that platform.

1. Enable Odoo Profiling

Odoo versions 14 and later include a powerful built-in profiler that can help identify slow code paths. You can activate it by adjusting your Odoo configuration to a debug level:

log_level = debug

2. Check PostgreSQL Slow Query Log

To identify resource-intensive database operations and long-running queries, enable slow query logging in your PostgreSQL configuration. This will log all queries exceeding a specified duration:

log_min_duration_statement = 1000 (logs queries longer than 1 second)

3. Monitor Server Resources

Utilize these common commands to observe your system's resource consumption in real-time and detect any spikes or consistent high usage across CPU, memory, disk I/O, and network:

htop, iotop, free -h, df -h

4. Identify Heavy Modules

Certain Odoo modules are known to potentially cause performance challenges, especially under specific workloads or with large datasets. Identifying these can help focus optimization efforts:

  • mail/discuss: This module can generate an excessive volume of database writes, particularly in highly active environments, significantly impacting overall performance.
  • stock: Involves complex inventory calculations and movements which can be demanding on large datasets, leading to slower operations.
  • mrp: Bill of materials (BOM) explosions, especially for complex products, can be computationally expensive processes, affecting production planning.
  • account: Managing large journal entries and complex reconciliation tasks can be resource-intensive, affecting financial reporting and closing processes.
  • Custom modules: Always review custom developments meticulously for N+1 queries, ensure appropriate database indexes are in place, and check for any inefficient loops or operations.

PostgreSQL Optimization

PostgreSQL serves as the foundational component for Odoo's performance, as most Odoo operations involve database interactions. Strategic configurations within PostgreSQL can significantly enhance query execution speeds and overall database efficiency, leading to a much more responsive Odoo instance.

Index Optimization

Regularly identify and add missing indexes to accelerate data retrieval and improve query performance. Use the following queries to help pinpoint potential index gaps and analyze index usage:

SELECT relname, reltuples, pg_relation_size(relid) FROM pg_class WHERE relkind = 'r' ORDER BY pg_relation_size(relid) DESC; (identifies large tables)

SELECT schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch FROM pg_stat_user_indexes WHERE idx_scan < 100; (helps find unused or underutilized indexes, or tables that might need new ones)

VACUUM and ANALYZE

Implement a schedule for routine maintenance operations such as VACUUM and ANALYZE to ensure optimal database performance, prevent bloat, and maintain up-to-date statistics for the query planner. Proper autovacuum settings are critical.

Configure `autovacuum` settings aggressively in `postgresql.conf` to run continuously in the background.

Schedule a weekly `VACUUM ANALYZE` during off-peak hours to reclaim space and update statistics comprehensively.

Connection Pooling with PgBouncer

For Odoo deployments utilizing multiple worker processes, PgBouncer is highly recommended to minimize the overhead associated with establishing and managing database connections. This leads to improved responsiveness, better resource utilization, and prevents the database from being overwhelmed by too many direct connections.

Install and configure PgBouncer to sit between Odoo and PostgreSQL, pooling database connections efficiently.

Worker Configuration

Accurate worker configuration is paramount for Odoo to efficiently handle concurrent user requests and maintain high responsiveness and stability. For environments deployed within containers, we also recommend consulting our Docker deployment guide for specific worker configuration advice in Dockerized settings, as containerization introduces unique considerations.

Parameter Description Recommendation
workers Number of HTTP worker processes responsible for handling user requests (CPU cores * 2) + 1 (A common starting point; adjust based on actual load)
max_cron_threads Threads dedicated to scheduled actions and background tasks 1-2 (rarely requiring more, as cron jobs are typically sequential or parallelized internally)
limit_memory_hard The maximum memory a worker process can consume before it is killed 2.5GB (adjust based on available RAM and typical workload, e.g., heavy reports)
limit_memory_soft The memory threshold at which a worker process is recycled after completing its current request 2GB (typically 80% of the hard limit, to ensure graceful restarts)
limit_time_cpu Maximum CPU time allowed per single request before it is terminated 600s (increase for intensive reports or complex operations that genuinely require more CPU)
limit_time_real Maximum wall-clock time permitted per request, including I/O waits 1200s (generally 2x the CPU limit, providing buffer for I/O operations)

Memory Calculation

It is crucial to ensure that your server has adequate RAM to prevent memory exhaustion and worker crashes. Calculate the required memory by considering: (number of workers * `limit_memory_hard`) + PostgreSQL memory allocation + operating system overhead. For instance, an Odoo setup with 9 workers, each configured with a 2.5GB memory hard limit, would necessitate a minimum of 24GB of RAM to operate stably and handle peak loads without issues.

Caching Strategies

Implementing effective caching mechanisms can significantly reduce database load, minimize redundant computations, and dramatically improve application response times for Odoo users. Caching is a powerful tool to offload your server and deliver content faster.

Redis for Session Storage

Transitioning from default file-based sessions to Redis provides superior performance, especially in multi-worker environments, by eliminating potential session locking issues and speeding up session access. Redis offers a fast, in-memory data store ideal for session management.

Configure Odoo to use Redis as the session store, replacing the default file-based system.

Query Caching with ORM Cache

Odoo's Object-Relational Mapper (ORM) includes a robust built-in caching system for computed fields and method calls. Leveraging this effectively can prevent repetitive database queries and computations, reducing load on PostgreSQL.

Ensure `cache_interval_for_jobs` and other ORM caching parameters are appropriately configured to optimize cache invalidation and refreshment.

Static Asset Caching with Nginx

Properly configuring Nginx to cache static assets (like CSS, JavaScript, and images) can significantly offload requests from your Odoo application, reducing server load and improving frontend delivery speeds by serving these files directly.

Add Nginx directives to cache static files with appropriate `expires` headers for long browser caching periods.

CDN for Static Assets

Utilizing a Content Delivery Network (CDN) such as Cloudflare or AWS CloudFront allows static assets to be served from edge locations geographically closer to your users. This strategy drastically reduces latency, improves loading times, and shifts traffic away from your primary Odoo server, enhancing global performance.

  • Configure your CDN to efficiently cache paths like `/web/static/*`, which contain most of Odoo's frontend assets.
  • Set appropriate cache headers, often one year for versioned assets, to maximize caching efficiency and minimize redundant downloads.
  • Enable compression mechanisms like gzip or brotli at the CDN level for faster data transfer over the network.
  • Where feasible, extend CDN usage to serve images and attachments, further optimizing delivery and reducing server load.

Frontend Optimization

Optimizing the frontend components of your Odoo application directly enhances the perceived performance for users and concurrently helps in reducing the processing load on your backend servers. A fast frontend leads to a better user experience.

Asset Bundling and Minification

Odoo automatically bundles and minifies assets (CSS, JavaScript) when operating in production mode. It's essential to confirm that your Odoo instance is running with the correct configuration settings to benefit from these optimizations, which reduce file sizes and the number of HTTP requests.

Verify `server_mode = production` in your Odoo configuration to enable asset bundling and minification.

Lazy Loading and Pagination

Strategically optimize the loading of list views and related fields to prevent overburdening the browser and server, especially when dealing with large datasets:

  • Set a reasonable `limit` on tree views; the default of 80 records is frequently too high for optimal performance and should be adjusted based on user needs.
  • Use `@api.onchange` decorators sparingly, as each trigger initiates a server round-trip, potentially accumulating latency and increasing server load.
  • Avoid loading Many2one fields with overly broad or large domains, which can fetch excessive data that may not be immediately necessary.
  • Employ `prefetch_fields` to optimize ORM queries, fetching related data efficiently in fewer database calls, thus reducing query counts.

Reduce Unnecessary API Calls

Identify and mitigate common scenarios that lead to an excessive number of API calls, which can degrade performance and consume valuable server resources:

  • Chatter/mail thread information loading on every page view, even when not needed, leading to redundant data fetches.
  • Status bar widgets executing with complex or frequently updated domain filters, causing constant server polling.
  • Dashboard widgets configured to poll the server too frequently for updates, even when data changes are infrequent.
  • Automated actions inadvertently triggering on every single record change, leading to a cascade of operations and potential bottlenecks.

Hardware Recommendations

Selecting appropriate hardware is fundamental and should be meticulously based on your anticipated concurrent user count and the specific workload demands of your Odoo installation. Undersized hardware is a common cause of performance issues. If you require assistance in determining your precise hardware needs, our server requirements calculator can provide personalized recommendations tailored to your specific situation.

Concurrent Users RAM CPU Storage
1-10 users 4GB 2 vCPU 50GB SSD
10-50 users 8GB 4 vCPU 100GB SSD
50-200 users 16GB 8 vCPU 250GB SSD
200+ users 32GB+ 16+ vCPU 500GB+ SSD

Additional Considerations

  • SSD is mandatory: For optimal PostgreSQL performance, NVMe SSDs are highly recommended due to their superior I/O capabilities, which are critical for database operations.
  • Separate database server: For deployments with 50 or more users, consider the benefits of a dedicated PostgreSQL server to isolate resources, enhance scalability, and improve database resilience.
  • Network latency: Always ensure that your database and application servers are co-located within the same datacenter or a very low-latency network segment to minimize communication delays.
  • Backup storage: Plan for adequate backup storage, ideally 2-3 times the size of your database, to accommodate retention policies and ensure robust data recovery capabilities in case of a disaster.

Monitoring Setup

Establishing a comprehensive monitoring system is vital for proactively identifying and addressing performance bottlenecks before they negatively impact your users and business operations. Effective monitoring allows for early detection of issues and informed decision-making.

Prometheus + Grafana Setup

The combination of Prometheus for data collection and Grafana for visualization is widely regarded as the recommended monitoring stack for modern Odoo deployments, offering powerful insights into system health and performance through customizable dashboards and alerting capabilities.

Integrate Prometheus exporters for Odoo (e.g., Odoo exporter), PostgreSQL (e.g., pg_exporter), and node-exporter for collecting system-level metrics.

Create informative Grafana dashboards to visualize key performance indicators and track trends over time.

Key Metrics to Monitor

Regularly track these essential metrics across your infrastructure to maintain a high-performing Odoo environment and quickly respond to anomalies:

System Metrics

  • CPU utilization (target: consistently under 80% during peak loads)
  • Memory usage (monitor closely for Out-Of-Memory events or high swap usage)
  • Disk I/O wait (target: ideally under 10% to indicate healthy disk performance)
  • Network throughput (watch for saturation or unexpected spikes in traffic)

PostgreSQL Metrics

  • Active connections (track concurrent users and potential bottlenecks from excessive connections)
  • Query duration (monitor p95 and p99 percentiles for slow queries to identify performance regressions)
  • Cache hit ratio (aim for consistently over 99% for optimal database buffer usage)
  • Replication lag (if applicable, ensure standby databases are up-to-date and within acceptable lag thresholds)

Odoo Metrics

  • Request latency (monitor p50 and p95 for overall application responsiveness and user experience)
  • Error rate (track 5xx responses to identify server-side issues and application failures)
  • Worker memory usage (ensure workers are operating within configured limits and not leaking memory)
  • Longpolling connections (for real-time features like chat, monitor stability and connectivity)

Business Metrics

  • Active users count (understand peak usage patterns and capacity planning)
  • Cron job execution time (identify long-running background tasks impacting system resources)
  • Email queue size (monitor for delays in outgoing communications and email server health)
  • Report generation time (track performance of critical reports used for business intelligence)

Recommended Alert Thresholds

Establish clear alert thresholds to be notified promptly when critical system or application metrics deviate from acceptable performance levels. Timely alerts are crucial for minimizing downtime and performance impact:

Metric Warning Critical
CPU Usage over 70% (indicates sustained high load) over 90% (indicates system is overloaded)
Memory Usage over 80% (approaching limits, potential for swapping) over 95% (critical, likely OOM or heavy swapping)
Disk Usage over 75% (storage nearly full, potential for failures) over 90% (critical, risk of application failure)
Request Latency (p95) over 2s (users experiencing noticeable delays) over 5s (severe performance degradation)
Error Rate over 1% (indicates recurring application errors) over 5% (critical, significant service disruption)

Performance Checklist

Utilize this comprehensive checklist to methodically review and ensure that all critical areas for Odoo performance optimization have been thoroughly addressed and configured. This structured approach helps in maintaining a high-performing and stable Odoo environment.

Database

  • PostgreSQL configured with optimized settings for Odoo workloads, including parameters like `shared_buffers` and `effective_cache_size`.
  • `shared_buffers` effectively set to approximately 25% of total system RAM for efficient caching of database blocks.
  • `effective_cache_size` configured to 50-75% of available RAM, informing the query planner about the available memory for caching.

Application

  • Worker processes are optimally configured to leverage available CPU cores and handle concurrent user sessions efficiently.
  • Memory limits (`limit_memory_hard`, `limit_memory_soft`) are properly defined and adhered to, preventing memory exhaustion and ensuring worker stability.

Caching

  • Redis caching is enabled and utilized for Odoo session storage, improving session management and reducing database load.

Frontend

  • Static assets are thoroughly minified and bundled for efficient delivery to users, reducing page load times.
  • A Content Delivery Network (CDN) is properly configured for serving static files, further speeding up asset delivery globally.

Maintenance

  • Regular `VACUUM` and `ANALYZE` operations are scheduled to maintain database health, prevent bloat, and ensure optimal query planning.

Monitoring

  • PostgreSQL slow query logging is activated for issue detection, helping to pinpoint inefficient queries.
  • A robust Prometheus/Grafana monitoring solution is actively in place for comprehensive system and application oversight.
  • Appropriate alert thresholds are configured to notify of performance deviations promptly, allowing for proactive intervention.

Tip: Bookmark this page to conveniently track your ongoing optimization progress and ensure all aspects are covered on your journey to a high-performing Odoo system.

Frequently Asked Questions

Why is my Odoo so slow?

Slow Odoo performance typically originates from one or a combination of several factors: insufficient hardware resources (such as RAM or CPU), an unoptimized PostgreSQL configuration, an incorrect number of workers (either too few or too many), absence of critical database indexes, the presence of heavy or poorly coded custom modules, or a complete lack of caching strategies. To begin diagnosing, it is recommended to first inspect your server's resource utilization during periods of peak usage to pinpoint the primary bottleneck and prioritize your optimization efforts.

How many workers should I configure for Odoo?

The generally recommended formula for calculating the number of workers is: workers = (CPU cores * 2) + 1. For example, a server equipped with 4 CPU cores should ideally run 9 workers. However, this count can vary depending on your specific workload and the nature of your operations; for instance, CPU-intensive operations like report generation might benefit from fewer workers. Always prioritize monitoring memory usage, as each worker typically consumes between 150-300MB of RAM, so ensure your server has ample memory.

What's the best PostgreSQL config for Odoo?

An optimal PostgreSQL configuration for Odoo usually includes: shared_buffers set to approximately 25% of available RAM, effective_cache_size configured at 50-75% of RAM, work_mem at around 64MB, and random_page_cost set to 1.1 when using SSD storage. Furthermore, it's crucial to enable aggressive autovacuum settings and implement connection pooling with PgBouncer, especially for multi-worker Odoo setups. These specific settings collectively lead to significant improvements in query performance and overall database efficiency, which are critical for Odoo.

Should I use Redis with Odoo?

Absolutely, incorporating Redis into your Odoo deployment can substantially enhance performance, particularly in environments with multiple worker processes. Utilize Redis for session storage to eliminate file-based session locking and accelerate access. It also serves as an excellent cache backend for computed fields and method caching, and can be used for robust queue management when integrated with the Odoo Queue Job module. Ensure Redis is configured with appropriate memory limits and eviction policies for optimal operation and stability.

How much RAM does Odoo need?

The RAM requirements for Odoo are directly influenced by your anticipated user count and the complexity of your workload. For deployments supporting 1-10 users, a minimum of 4GB RAM is typically sufficient. For 10-50 users, you should plan for at least 8GB. For larger installations catering to 50-200 users, allocating 16GB of RAM is advisable. A general calculation for RAM is: (number of workers × 250MB) + PostgreSQL memory allocation + operating system overhead. For instance, a setup with 9 workers would require at least 8GB of RAM, but 16GB is highly recommended for production workloads to provide ample headroom and prevent performance degradation.

How to diagnose Odoo performance issues?

To effectively diagnose Odoo performance issues, begin by enabling Odoo profiling (by setting log_level = debug) and PostgreSQL slow query logging (by setting log_min_duration_statement = 1000). Concurrently, monitor your server's resources using tools like htop for CPU/memory, iotop for disk I/O, and observe PostgreSQL's active connections. For Odoo 15+, leverage the built-in Odoo profiler module to pinpoint slow requests. Key areas to investigate include identifying N+1 queries, checking for missing database indexes, and scrutinizing any custom modules that might be contributing to the slowdown.

Does Odoo need SSD storage?

Yes, the use of SSD storage is very strongly recommended for all Odoo deployments. PostgreSQL's performance, especially when handling complex queries and generating reports, is heavily dependent on disk I/O speed. SSDs offer significantly faster random read/write operations (typically 10-100 times faster) compared to traditional HDDs. When utilizing SSDs, ensure you set random_page_cost to 1.1 in your PostgreSQL configuration for optimized query planning, which acknowledges the faster access times of SSDs.

How often should I run VACUUM on PostgreSQL?

For Odoo databases, it is highly recommended to configure autovacuum to run continuously with aggressive settings to prevent table bloat and ensure data visibility, especially for frequently updated tables. Additionally, schedule a weekly VACUUM ANALYZE operation during periods of low traffic. This helps reclaim dead space and ensures that PostgreSQL's query planner has the most up-to-date statistics for efficient query execution. For tables that experience very heavy updates (e.g., ir_attachment, mail_message), consider performing more frequent manual VACUUM operations as needed to maintain optimal performance.

Was this answer helpful? 0 Users Found This Useful (0 Votes)