ERP

    Odoo Performance Optimization: Speed Up Your ERP

    Slow Odoo performance frustrates users and reduces productivity. This guide covers PostgreSQL tuning, worker configuration, caching strategies, and infrastructure optimization for faster ERP operations.

    VT
    11 min read
    Share

    Key Takeaways

    • PostgreSQL tuning is the single biggest performance improvement for most Odoo deployments
    • Worker count should be set to (2 x CPU cores + 1) with proper memory limits
    • Redis session store and CDN for static assets reduce server load significantly
    • Regular database maintenance (VACUUM ANALYZE, archiving old data) prevents degradation
    • Monitor with Prometheus/Grafana to identify bottlenecks before users complain

    PostgreSQL Performance Tuning

    PostgreSQL configuration is the single most impactful performance optimization for Odoo. Default PostgreSQL settings are conservative and designed for minimal resource usage, not production ERP workloads.

    ParameterDefaultRecommendedPurpose
    shared_buffers128MB25% of RAMShared memory for caching
    effective_cache_size4GB75% of RAMQuery planner cost estimation
    work_mem4MB32-64MBPer-operation sort/hash memory
    maintenance_work_mem64MB512MB-1GBVACUUM, CREATE INDEX memory
    random_page_cost4.01.1 (SSD)SSD-aware query planning
    checkpoint_completion_target0.50.9Spread checkpoint I/O
    PGTune

    Use PGTune (pgtune.leopard.in.ua) to generate optimized PostgreSQL configuration based on your server specifications. Input your RAM, CPU count, storage type, and connection count for customized recommendations.

    Odoo Worker Configuration

    Odoo workers handle incoming requests. Proper worker configuration balances concurrency with resource consumption to prevent server overload.

    ParameterFormula/ValuePurpose
    workers(2 x CPU cores) + 1Number of HTTP request handlers
    max_cron_threads2Background job processors
    limit_memory_hard2684354560 (2.5GB)Kill worker exceeding this RAM
    limit_memory_soft2147483648 (2GB)Recycle worker after request
    limit_time_cpu60Max CPU seconds per request
    limit_time_real120Max wall-clock seconds per request
    limit_request8192Recycle worker after N requests
    Memory Calculation

    Total RAM needed = (workers + max_cron_threads) x limit_memory_hard + PostgreSQL memory. For 8 workers + 2 cron threads: 10 x 2.5GB = 25GB for Odoo alone. Size your server accordingly.

    Caching and CDN Configuration

    Caching reduces server load by serving frequently requested data from fast storage. A CDN offloads static assets to edge servers closer to users.

    1. Install Redis and configure Odoo to use Redis for session storage (faster than PostgreSQL sessions)
    2. Configure Nginx to cache static assets (images, CSS, JS) with long expiration headers
    3. Set up a CDN (Cloudflare, AWS CloudFront) for static asset delivery
    4. Enable Odoo's asset bundling and minification in production mode
    5. Configure browser caching headers: 1 year for versioned assets, 1 hour for HTML
    6. Use Nginx micro-caching for anonymous pages (website, product catalog)

    Redis session storage is particularly important for multi-worker deployments. Without Redis, sessions are stored in PostgreSQL, adding database load. With Redis, session lookups are sub-millisecond.

    Database Maintenance and Cleanup

    Odoo databases accumulate data that degrades performance over time. Regular maintenance keeps the database lean and queries fast.

    Maintenance TaskFrequencyImpact
    VACUUM ANALYZEDaily (automated)Reclaims space, updates statistics
    Archive mail messagesMonthlyReduces mail_message table bloat
    Purge old logsMonthlyReduces ir_logging table size
    Clean attachmentsQuarterlyRemoves orphaned file references
    Reindex tablesQuarterlyRebuilds indexes for efficiency
    Archive old recordsAnnuallyMoves historical data to archive
    Bloat Culprits

    The mail_message, ir_attachment, and ir_logging tables are the most common sources of database bloat. A 3-year-old Odoo instance can have millions of mail_message records. Archiving or purging old entries can reduce database size by 30-50%.

    Infrastructure Monitoring and Sizing

    Proactive monitoring identifies performance issues before users notice them. Proper infrastructure sizing prevents capacity-related slowdowns.

    Concurrent UsersOdoo ServerPostgreSQL ServerArchitecture
    10-252 CPU, 4GB RAM2 CPU, 8GB RAMSingle server OK
    25-504 CPU, 8GB RAM4 CPU, 16GB RAMSeparate DB recommended
    50-1008 CPU, 16GB RAM8 CPU, 32GB RAMSeparate servers required
    100-20016 CPU, 32GB RAM16 CPU, 64GB RAMLoad balancer + replicas
    200+Multiple app serversPrimary + replicasFull HA architecture
    • Monitor: response time (p95 should be under 3 seconds), CPU usage, memory consumption
    • Alert thresholds: CPU above 80% sustained, RAM above 85%, response time above 5 seconds
    • Tools: Prometheus + Grafana dashboards, or Datadog/New Relic for managed monitoring
    • Log analysis: centralize Odoo and PostgreSQL logs with ELK stack or Loki for troubleshooting

    Frequently Asked Questions

    Need Help Implementing This?

    Our team can help you put these insights into practice.

    Schedule a Consultation