Diagnosis First
Before fixing, identify the bottleneck. Odoo slowness has three root causes: server resources (CPU/RAM), database queries, or frontend loading.
Fix 1: Enable Workers (Impact: HIGH)
# odoo.conf — MOST COMMON fix
# workers = 0 means single-threaded (development mode)
# Change to multi-process:
workers = 5 # (CPU cores × 2) + 1This alone can improve throughput 5-10x. Without workers, Odoo handles one request at a time.
Fix 2: PostgreSQL shared_buffers (Impact: HIGH)
# Default: 128MB (designed for a laptop)
# Production: 25% of RAM
shared_buffers = 4GB # For 16GB server
effective_cache_size = 12GB
random_page_cost = 1.1 # SSD storageFix 3: Memory Limits (Impact: HIGH)
# Prevent OOM kills
limit_memory_hard = 2684354560 # 2.5GB
limit_memory_soft = 2147483648 # 2.0GB
limit_time_real = 120
limit_time_cpu = 60Fix 4: Database Indexes (Impact: HIGH)
# Find slow queries first
log_min_duration_statement = 500 # Log queries > 500ms
# Common missing indexes for Odoo:
CREATE INDEX CONCURRENTLY idx_mail_message_date
ON mail_message (date DESC);
CREATE INDEX CONCURRENTLY idx_mail_message_model_res
ON mail_message (model, res_id);
CREATE INDEX CONCURRENTLY idx_ir_attachment_res
ON ir_attachment (res_model, res_id);Fix 5: Autovacuum (Impact: MEDIUM)
# Prevent table bloat
autovacuum_vacuum_scale_factor = 0.05 # Default 0.2 is too high
autovacuum_analyze_scale_factor = 0.05
autovacuum_max_workers = 4Fix 6: Disable Demo Data (Impact: MEDIUM)
# Demo data adds thousands of records that slow searches
# odoo.conf:
without_demo = allFix 7: Nginx Static Caching (Impact: MEDIUM)
location ~* /web/static/ {
proxy_pass http://127.0.0.1:8069;
expires 7d;
add_header Cache-Control "public, immutable";
access_log off;
}Fix 8: Disable Unnecessary Modules (Impact: MEDIUM)
Each installed module adds models, views, and crons. Uninstall modules you do not use — especially heavy ones like Website, eCommerce, and Marketing if not needed.
Fix 9: Asset Bundling Mode (Impact: MEDIUM)
# In production, do NOT run with --dev=all
# Assets are bundled and minified by default in production mode
# If assets seem stale, click: Settings → Technical → Asset Bundles → ClearFix 10: Connection Pooling (Impact: MEDIUM)
# For high-traffic: PgBouncer between Odoo and PostgreSQL
# pgbouncer.ini:
pool_mode = transaction
default_pool_size = 50Fix 11: Reduce db_maxconn (Impact: LOW-MEDIUM)
# Default 64 per worker is too high
# 5 workers × 64 = 320 potential connections
db_maxconn = 16 # More realisticFix 12: Optimize Custom Code (Impact: VARIABLE)
# Common code issues:
# 1. N+1 queries: loop with search inside
for order in orders:
partner = order.partner_id # ← lazy load each
# Fix: prefetch
orders.mapped('partner_id') # Prefetch all at once
# 2. search() in computed fields without store=True
# Fix: add store=True or precompute=True if appropriate
# 3. Large read_group without limits
# Fix: add limit parameterFix 13: Monitoring (Impact: ONGOING)
# Check what is slow:
# 1. Odoo logs: grep for slow requests
grep 'duration' /var/log/odoo/odoo.log | awk '$NF > 5' | tail -20
# 2. PostgreSQL: top queries
SELECT calls, mean_exec_time, left(query, 80)
FROM pg_stat_statements
ORDER BY mean_exec_time DESC LIMIT 10;
# 3. System: check resources
htop # CPU and memory
iostat -x 1 # Disk I/OFix 14: Upgrade Hardware (Impact: DIRECT)
| Users | Minimum | Recommended |
|---|---|---|
| 1-10 | 2 CPU, 4GB RAM | 4 CPU, 8GB RAM |
| 10-50 | 4 CPU, 8GB RAM | 8 CPU, 16GB RAM |
| 50-200 | 8 CPU, 16GB RAM | 16 CPU, 32GB RAM |
Fix 15: Use DeployMonkey
DeployMonkey applies all 14 fixes above automatically — optimized workers, tuned PostgreSQL, nginx caching, memory limits, and monitoring. The AI agent continuously monitors performance and suggests optimizations specific to your workload.