100% found this document useful (1 vote)
693 views

Odoo 12, Performance DB and Python Tips

This document provides tips for optimizing the performance of an Odoo deployment. It recommends deploying with 1-2 worker processes per CPU core and scaling out to additional servers as needed. Key metrics to monitor include PostgreSQL transactions/minute, Odoo requests/minute and duration, disk I/O, system load and memory usage, and network bandwidth. Munin is suggested for monitoring. The document also provides tips for optimizing PostgreSQL settings, identifying slow queries, and sampling Odoo workers to analyze long-running transactions. Regular updates, monitoring, and optimization are emphasized.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
693 views

Odoo 12, Performance DB and Python Tips

This document provides tips for optimizing the performance of an Odoo deployment. It recommends deploying with 1-2 worker processes per CPU core and scaling out to additional servers as needed. Key metrics to monitor include PostgreSQL transactions/minute, Odoo requests/minute and duration, disk I/O, system load and memory usage, and network bandwidth. Munin is suggested for monitoring. The document also provides tips for optimizing PostgreSQL settings, identifying slow queries, and sampling Odoo workers to analyze long-running transactions. Regular updates, monitoring, and optimization are emphasized.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Performance

Tips &
Tricks

Olivier Dony
@odony
1 Deploying
Deployment Architecture
Rules of thumb
+ Enforce limits
+ Recycle processes
Activate multi-worker to use your fancy hardware! + Perform better
+ Sync changes

How many workers processes? 1 per CPU core, x2 for recycling

Min = 6 (typical browser keepalive pool size)

Dedicated RAM RAM = 24GB = 24 workers


Max = e.g.
Worker soft memory limit Soft limit = 1GB

How many requests/second? ~ 6-7 x Workers e.g. 24 workers = 160 r/s

How many users? ~ 5-10 per Worker e.g. 24 active workers = 180 users
Deployment Architecture
Scaling: example 1 Backend
+
Frontend

Odoo Server
 n
Workers: 20

o
at
p lic
re
 100 users 16c/32t
Xeon E5 2640v3 –
 10000 visitors/day 2.6GHz
Odoo Server (B) 64 GB RAM
Workers: 20
Deployment Architecture
Scaling: example 2
Frontend Backend
Odoo
Workers:10 NFS

DB + File
 Load
Balancer Odoo
NFS Server

Workers:10
NFS

 300 users 6c/12t


Xeon E5 1650v3 –
 25000 visitors/day Odoo 3.5GHz
Workers:10 64 GB RAM
4c/8t
3X Xeon E5 1630v3 - + replicaton of backend
3.7GHz
32 GB RAM
Deployment Architecture
Recommendations
+ SSL Termination
Setup a reverse proxy in front of Odoo + Gzip
+ Serve static assets
+ Load balancing
+ Block access to DB manager

Backend (DB): max I/O, RAM and Speed 64GB + SSD + 3.5GHz Base CPU speed

Frontend (HTTP): max Speed and # Cores 6c/12t 3.5GHz Base CPU speed
2 Measuring &
Monitoring
Watch your deployment’s
performance

PostgreSQL: transactions / minute

Odoo: requests / minute, avg duration

Disk: response time, IOPS

System: load, I/O wait, memory

Network: connections, bandwidth

Establish your
performance baseline
Watch your deployment’s Suggested tool: Munin
performance

PostgreSQL: transactions / minute day week

Odoo: requests / minute, avg duration

Disk: response time, IOPS month year

System: load, I/O wait, memory


 Built-in plugins for most key metrics
Network: connections, bandwidth  Writing plugins is trivial
 Constant storage footprint (rrdtool)
 Configurable limits/warnings

Establish your Example plugins


performance baseline  Nginx times: https://git.io/vP3Sj
 Odoo times: https://git.io/vP3h9
3 Optimizing
Update
your deployment

regularly
Optimizing your Deployment
PostgreSQL

Verify the usual server settings: effective_cache_size, work_mem, shared_buffers


 See also documentation: https://wiki.postgresql.org/wiki/Performance_Optimization

Log slow queries: log_min_statement_duration = 500


 Then watch slow queries in PostgreSQL log file
 Use EXPLAIN ANALYZE <query> to verify the plan See also https://explain.depesz.com
 Verify statistics and vacuuming (autovacuum!)
 Create missing indexes carefully (composite, order, etc.)
 Create missing FK indexes to fix slow deletion
Sample the system while running
PostgreSQL

Install pg_activity to watch the database

+ htop-like for PostgreSQL


+ Running/Waiting/Blocking queries
+ Read/Write per second
+ Pause, kill queries, etc.
+ CPU/Memory/Load
Sample the system while running
Odoo Workers

Send SIGQUIT to dump worker stacks: kill -3 <odoo_worker_pid>

+ Easy to send from htop


+ Repeat to analyze long running
transactions
Summary

1 Plan and deploy properly, scale as needed


2 Setup precise monitoring
3 Update, Sample, Optimize

This is the basic checklist for performance investigation!


 Tech support @ www.odoo.com/help

You might also like