SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
S N • R
EXPERIENCE
2019
Tools for solving perf issues
 @nseinlet •  @nseinlet •  @nseinlet •  nse@odoo.com
 Basic ones
1
 Python2
 PostgreSQL3
 Conclusion4
“Never a database with production grade datas on your laptop.
N E V E R
Some facts
 Using Linux computer
 Mainly command line
 Through SSH
 And obviously a web browser...
Most basic ones
1
Since 12.0
[options]
log_level = info
In the Odoo logs
2018-09-28 12:19:01,246 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:19:01] "GET /web HTTP/1.0" 200 - 873 0.429 1.593
2018-09-28 12:18:43,322 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:18:43] "GET /web HTTP/1.0" 200 - 1484 0.932 4.519
Number of queries
Time spent executing SQL queries
Time spent to process query, except SQL time
0 100 1000
0 0.1 3
0 1 5
https://github.com/odoo/odoo/blob/saas-11.5/odoo/netsvc.py#L90
Parse/sort them
Processing time per hour?
2018-09-28 12:19:01,246 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:19:01] "GET /web HTTP/1.0" 200 - 873 0.429 1.593
2018-09-28 12:18:43,322 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:18:43] "GET /web HTTP/1.0" 200 - 1484 0.932 4.519
cat odoo.log | grep -v longpolling | awk '{print $NF " " $0}' | sort -n | less
4.519 2018-09-28 12:18:43,322 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:18:43] "GET /web HTTP/1.0" 200 - 1484 0.932 4
1.593 2018-09-28 12:19:01,246 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:19:01] "GET /web HTTP/1.0" 200 - 873 0.429 1
cat odoo.log | grep -v longpolling | awk '{split($2,a,":"); arr[a[1]]+=$NF;arr2[a[1]]+=1;} END {for (i in arr) {print i,arr[i],arr2[i]}}
Get system infos
$ inxi -Fxz
 Python
2
For Python profiling details, check my last year talk1
Reproducing is the key2
Doing it manually is not accurate3
Let's work on a use case
Have the description of the issue1
Have the customer database/code running on an isolated server2
Reproduce the issue using a script3
Profile python with odoo.tools.misc.profile4
Log PostgreSQL queries5
Analyse and solve6
Do it again and again7
import openerplib
import datetime
connection = openerplib.get_connection(
hostname="myserver", port=443, database="stock", login="admin", password="admin_paasw
)
connection.check_login(force=False)
picking_model = connection.get_model("stock.picking")
sm_model = connection.get_model("stock.move")
product_model = connection.get_model("product.product")
for i in range(1, 100):
product_model.create({"name": "product %s" % i, "type": "product", "uom_id": 1})
lines = []
prod_ids = product_model.search([("type", "=", "product"), ("uom_id", "=", 1)])
for prod in prod_ids:
lines.append((0, 0, {"product_id": prod, "product_uom_qty": 1, "name": "product %s" %
print("Start picking : %s" % datetime.datetime.now().isoformat())
pick_id = picking_model.create(
{
"scheduled_date": "2017-09-10 11:30:29",
"move_type": "direct",
"picking_type_id": 7,
"location_dest_id": 9,
"picking_type_code": "outgoing",
"location_id": 26,
"move_lines": lines,
}
)
print("Picking created (%s lines) : %s" % (len(lines), datetime.datetime.now().isoformat
move_ids = sm_model.search([("picking_id", "=", pick_id)])
for move_id in move_ids:
sm_model.write(move_id, {"quantity_done": 1})
print("Picking lines done : %s" % datetime.datetime.now().isoformat())
picking_model.button_validate(pick_id)
print("Picking validated : %s" % datetime.datetime.now().isoformat())
M POS
Issue is a concurrency issue, which means we should call multiple workers at the same time, in a repeatable
way, to create pos orders or close pos sessions.
I've set the password as computable from user to ease the reproduction_protocol.
mport odoolib
mport sys
mport random
mport threading
rom datetime import datetime, date
ef selling(username, password, size):
[...]
ef closing(username, password):
connection = odoolib.get_connection(hostname="my_server", database="mydb
config_model = connection.get_model('pos.config')
session_model = connection.get_model('pos.session')
order_model = connection.get_model('pos.order')
# Search config
config_id = config_model.search([('name', 'ilike', pos_id)])
if len(config_id) > 1:
config_id = config_id[0]
# Open session
config_model.open_session_cb(config_id)
pos_config = config_model.read(config_id, ['current_session_id', 'journa
session_id = pos_config['current_session_id'][0]
order_ids = order_model.search([['session_id', '=', session_id]])
if __name__ == "__
if len(sys.arg
print("Usa
print("")
print("Ex
print("
print(" To
print("
else:
concurrenc
lst_thd =
for i in r
pos_id
pos_id
userna
passwo
if sys
si
if
th
else:
th
thd.st
t1 = datetime.now()
session_model.action_pos_session_closing_control(session_id)
t2 = datetime.now()
print("%s closed session %s in %s seconds (%s orders)" % (username, sess
lst_th
for thd in
thd.jo
S
On various workers, in various chunks.
import threading
#How many workers will I load?
max_connections = 48
semaphore = threading.BoundedSemaphore(max_connections)
lst_thd = []
def process_company(company_id, date_from, date_to):
try:
connection = odoolib.get_connection(hostname="load", database="odoo", login="adm
[...]
chunk_size = 2000
chunks_rent_ids = [rent_ids[x : x + chunk_size] for x in range(0, len(rent_ids),
[...]
finally:
semaphore.release()
if __name__ == "__main__":
connection = odoolib.get_connection(hostname="load", database="odoo", login="admin",
[...]
# Split the work
thd_to_launch = []
for p in to_process:
thd_to_launch.append((p[0], d_start.strftime("%Y-%m-%d"), d_end.strftime("%Y-%m-%
for ttl in thd_to_launch:
# Semaphore
semaphore.acquire()
thd = threading.Thread(target=process_company, args=ttl)
thd.start()
lst_thd.append(thd)
for thd in lst_thd:
thd.join()
 PostgreSQL
3
“Because a good presentation have PostgreSQL slides. --Self
pg_activity
I simply launch it with more rights
~/.psqlrc
set QUIET 1
pset null '¤'
set PROMPT1 '%[%033[1m%][%/] # '
-- SELECT * FROM<enter>. %R shows what type of input it expects.
set PROMPT2 '... > '
timing
x auto
set VERBOSITY verbose
set HISTFILE ~/.psql_history- :DBNAME
set HISTCONTROL ignoredups
set COMP_KEYWORD_CASE upper
setenv EDITOR 'vim'
unset QUIET
Parallel workers
Workers used for query
processing is based on a
geometric progression
with 3 as common ratio
and
min_parallel_relation_size
as scale factor.
Considering the 8MB of
default parameter:
Size Worker
<8 MB 0
<24 MB 1
<72 MB 2
<216 MB 3
<684 MB 4
<1944 MB 5
<5822 MB 6
... ...
Improve query speed @ CPU cost1
max_worker_processes2
max_parallel_workers3
system wide workers for parallel processing
<= max_worker_processes
max_parallel_workers_per_gather4
query wide workers for parallel processing
<= max_parallel_workers
Max 4 per our recommendation
WAL size growth
Five minutes later...  <10  >=10
pg_current_xlog_location pg_current_wal_lsn
pg_xlog_location_diff pg_wal_lsn_diff
[postgres] # SELECT pg_current_wal_insert_lsn();
pg_current_wal_insert_lsn
---------------------------
3D/B4020A58
(1 row)
Time: 13.237 ms
[postgres] # SELECT pg_current_wal_insert_lsn();
pg_current_wal_insert_lsn
---------------------------
3E/2203E0F8
(1 row)
Time: 7.137 ms
[postgres] # SELECT pg_wal_lsn_diff('3E/2203E0F8', '3D/B4020A58');
pg_wal_lsn_diff
-----------------
1845614240
(1 row)
Time: 1.041 ms
 Conclusions
5
Tools for solving performance issues
ce
P
rofile  An
alyse
Rep
rod

Im
prove
Not just a fix_it.py , sorry.1
Reproducing in a reliable way is the key.2
A load test can prevent this.3
N S • R
EXPERIENCE
2019
Thank you!
 @nseinlet •  @nseinlet •  @nseinlet •  nse@odoo.com
#odooexperience

Más contenido relacionado

La actualidad más candente

Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
Command Prompt., Inc
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
Sveta Smirnova
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
Odoo
 

La actualidad más candente (20)

Common Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsCommon Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo apps
 
Simple Odoo ERP auto scaling on AWS
Simple Odoo ERP auto scaling on AWSSimple Odoo ERP auto scaling on AWS
Simple Odoo ERP auto scaling on AWS
 
Odoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best PracticesOdoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best Practices
 
Odoo Experience 2018 - Code Profiling in Odoo
Odoo Experience 2018 - Code Profiling in OdooOdoo Experience 2018 - Code Profiling in Odoo
Odoo Experience 2018 - Code Profiling in Odoo
 
OpenERP Performance Benchmark
OpenERP Performance BenchmarkOpenERP Performance Benchmark
OpenERP Performance Benchmark
 
Odoo External API
Odoo External APIOdoo External API
Odoo External API
 
엘라스틱서치 실무 가이드_202204.pdf
엘라스틱서치 실무 가이드_202204.pdf엘라스틱서치 실무 가이드_202204.pdf
엘라스틱서치 실무 가이드_202204.pdf
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouse[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouse
 
Developing New Widgets for your Views in Owl
Developing New Widgets for your Views in OwlDeveloping New Widgets for your Views in Owl
Developing New Widgets for your Views in Owl
 
Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용
 
MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
 
소프트웨어 부트캠프 설계 및 운영사례(42Seoul)
소프트웨어 부트캠프 설계 및 운영사례(42Seoul)소프트웨어 부트캠프 설계 및 운영사례(42Seoul)
소프트웨어 부트캠프 설계 및 운영사례(42Seoul)
 
메타버스 서비스에 Android 개발자가 할 일이 있나요?
메타버스 서비스에 Android 개발자가 할 일이 있나요?메타버스 서비스에 Android 개발자가 할 일이 있나요?
메타버스 서비스에 Android 개발자가 할 일이 있나요?
 
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEOTricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
Tricks every ClickHouse designer should know, by Robert Hodges, Altinity CEO
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
 
Plazma - Treasure Data’s distributed analytical database -
Plazma - Treasure Data’s distributed analytical database -Plazma - Treasure Data’s distributed analytical database -
Plazma - Treasure Data’s distributed analytical database -
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
odoo 11.0 development (CRUD)
odoo 11.0 development (CRUD)odoo 11.0 development (CRUD)
odoo 11.0 development (CRUD)
 

Similar a Tools for Solving Performance Issues

fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
Wesley Beary
 
OpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con PythonOpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con Python
PyCon Italia
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & Mercurial
Widoyo PH
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
Simon Su
 

Similar a Tools for Solving Performance Issues (20)

fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
A miało być tak... bez wycieków
A miało być tak... bez wyciekówA miało być tak... bez wycieków
A miało być tak... bez wycieków
 
Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.js
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
 
Automating Workflows for Analytics Pipelines
Automating Workflows for Analytics PipelinesAutomating Workflows for Analytics Pipelines
Automating Workflows for Analytics Pipelines
 
Monitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachineMonitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachine
 
Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: Backend
 
OpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con PythonOpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con Python
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & Mercurial
 
Writing and Publishing Puppet Modules
Writing and Publishing Puppet ModulesWriting and Publishing Puppet Modules
Writing and Publishing Puppet Modules
 
Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
I want my model to be deployed ! (another story of MLOps)
I want my model to be deployed ! (another story of MLOps)I want my model to be deployed ! (another story of MLOps)
I want my model to be deployed ! (another story of MLOps)
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
Software Project Management
Software Project ManagementSoftware Project Management
Software Project Management
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 
Back to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationBack to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB Application
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
 

Más de Odoo

Más de Odoo (20)

Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!
 
Odoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-ViewerOdoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-Viewer
 
Keynote - Vision & Strategy
Keynote - Vision & StrategyKeynote - Vision & Strategy
Keynote - Vision & Strategy
 
Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14
 
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting CapabilityExtending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
 
Managing Multi-channel Selling with Odoo
Managing Multi-channel Selling with OdooManaging Multi-channel Selling with Odoo
Managing Multi-channel Selling with Odoo
 
Product Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseProduct Configurator: Advanced Use Case
Product Configurator: Advanced Use Case
 
Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?
 
Rock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced OperationsRock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced Operations
 
Transition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organizationTransition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organization
 
Synchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the CrisisSynchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the Crisis
 
Running a University with Odoo
Running a University with OdooRunning a University with Odoo
Running a University with Odoo
 
Down Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in OdooDown Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in Odoo
 
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach foodOdoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
 
Migration from Salesforce to Odoo
Migration from Salesforce to OdooMigration from Salesforce to Odoo
Migration from Salesforce to Odoo
 
Preventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine LearningPreventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine Learning
 
Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification
 
Instant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping LabelInstant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping Label
 
How Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 FoldHow Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 Fold
 
From Shopify to Odoo
From Shopify to OdooFrom Shopify to Odoo
From Shopify to Odoo
 

Último

Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
amitlee9823
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
Abortion pills in Kuwait Cytotec pills in Kuwait
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Anamikakaur10
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
dlhescort
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
 

Último (20)

Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
Falcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investorsFalcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investors
 
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceEluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business Growth
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptx
 
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLJAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 

Tools for Solving Performance Issues

  • 1. S N • R EXPERIENCE 2019 Tools for solving perf issues  @nseinlet •  @nseinlet •  @nseinlet •  nse@odoo.com
  • 3. “Never a database with production grade datas on your laptop. N E V E R
  • 4. Some facts  Using Linux computer  Mainly command line  Through SSH  And obviously a web browser...
  • 6. Since 12.0 [options] log_level = info In the Odoo logs 2018-09-28 12:19:01,246 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:19:01] "GET /web HTTP/1.0" 200 - 873 0.429 1.593 2018-09-28 12:18:43,322 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:18:43] "GET /web HTTP/1.0" 200 - 1484 0.932 4.519 Number of queries Time spent executing SQL queries Time spent to process query, except SQL time 0 100 1000 0 0.1 3 0 1 5 https://github.com/odoo/odoo/blob/saas-11.5/odoo/netsvc.py#L90
  • 7. Parse/sort them Processing time per hour? 2018-09-28 12:19:01,246 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:19:01] "GET /web HTTP/1.0" 200 - 873 0.429 1.593 2018-09-28 12:18:43,322 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:18:43] "GET /web HTTP/1.0" 200 - 1484 0.932 4.519 cat odoo.log | grep -v longpolling | awk '{print $NF " " $0}' | sort -n | less 4.519 2018-09-28 12:18:43,322 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:18:43] "GET /web HTTP/1.0" 200 - 1484 0.932 4 1.593 2018-09-28 12:19:01,246 5283 INFO saas115nse werkzeug: 127.0.0.1 - - [28/Sep/2018 12:19:01] "GET /web HTTP/1.0" 200 - 873 0.429 1 cat odoo.log | grep -v longpolling | awk '{split($2,a,":"); arr[a[1]]+=$NF;arr2[a[1]]+=1;} END {for (i in arr) {print i,arr[i],arr2[i]}}
  • 8. Get system infos $ inxi -Fxz
  • 10. For Python profiling details, check my last year talk1 Reproducing is the key2 Doing it manually is not accurate3
  • 11. Let's work on a use case Have the description of the issue1 Have the customer database/code running on an isolated server2 Reproduce the issue using a script3 Profile python with odoo.tools.misc.profile4 Log PostgreSQL queries5 Analyse and solve6 Do it again and again7
  • 12. import openerplib import datetime connection = openerplib.get_connection( hostname="myserver", port=443, database="stock", login="admin", password="admin_paasw ) connection.check_login(force=False) picking_model = connection.get_model("stock.picking") sm_model = connection.get_model("stock.move") product_model = connection.get_model("product.product") for i in range(1, 100): product_model.create({"name": "product %s" % i, "type": "product", "uom_id": 1}) lines = [] prod_ids = product_model.search([("type", "=", "product"), ("uom_id", "=", 1)]) for prod in prod_ids: lines.append((0, 0, {"product_id": prod, "product_uom_qty": 1, "name": "product %s" % print("Start picking : %s" % datetime.datetime.now().isoformat()) pick_id = picking_model.create( { "scheduled_date": "2017-09-10 11:30:29", "move_type": "direct", "picking_type_id": 7, "location_dest_id": 9, "picking_type_code": "outgoing", "location_id": 26, "move_lines": lines, } ) print("Picking created (%s lines) : %s" % (len(lines), datetime.datetime.now().isoformat
  • 13. move_ids = sm_model.search([("picking_id", "=", pick_id)]) for move_id in move_ids: sm_model.write(move_id, {"quantity_done": 1}) print("Picking lines done : %s" % datetime.datetime.now().isoformat()) picking_model.button_validate(pick_id) print("Picking validated : %s" % datetime.datetime.now().isoformat())
  • 14. M POS Issue is a concurrency issue, which means we should call multiple workers at the same time, in a repeatable way, to create pos orders or close pos sessions. I've set the password as computable from user to ease the reproduction_protocol. mport odoolib mport sys mport random mport threading rom datetime import datetime, date ef selling(username, password, size): [...] ef closing(username, password): connection = odoolib.get_connection(hostname="my_server", database="mydb config_model = connection.get_model('pos.config') session_model = connection.get_model('pos.session') order_model = connection.get_model('pos.order') # Search config config_id = config_model.search([('name', 'ilike', pos_id)]) if len(config_id) > 1: config_id = config_id[0] # Open session config_model.open_session_cb(config_id) pos_config = config_model.read(config_id, ['current_session_id', 'journa session_id = pos_config['current_session_id'][0] order_ids = order_model.search([['session_id', '=', session_id]]) if __name__ == "__ if len(sys.arg print("Usa print("") print("Ex print(" print(" To print(" else: concurrenc lst_thd = for i in r pos_id pos_id userna passwo if sys si if th else: th thd.st
  • 15. t1 = datetime.now() session_model.action_pos_session_closing_control(session_id) t2 = datetime.now() print("%s closed session %s in %s seconds (%s orders)" % (username, sess lst_th for thd in thd.jo
  • 16. S On various workers, in various chunks. import threading #How many workers will I load? max_connections = 48 semaphore = threading.BoundedSemaphore(max_connections) lst_thd = [] def process_company(company_id, date_from, date_to): try: connection = odoolib.get_connection(hostname="load", database="odoo", login="adm [...] chunk_size = 2000 chunks_rent_ids = [rent_ids[x : x + chunk_size] for x in range(0, len(rent_ids), [...] finally: semaphore.release() if __name__ == "__main__": connection = odoolib.get_connection(hostname="load", database="odoo", login="admin", [...] # Split the work thd_to_launch = [] for p in to_process: thd_to_launch.append((p[0], d_start.strftime("%Y-%m-%d"), d_end.strftime("%Y-%m-% for ttl in thd_to_launch: # Semaphore semaphore.acquire() thd = threading.Thread(target=process_company, args=ttl) thd.start()
  • 17. lst_thd.append(thd) for thd in lst_thd: thd.join()
  • 19. “Because a good presentation have PostgreSQL slides. --Self
  • 20. pg_activity I simply launch it with more rights
  • 21. ~/.psqlrc set QUIET 1 pset null '¤' set PROMPT1 '%[%033[1m%][%/] # ' -- SELECT * FROM<enter>. %R shows what type of input it expects. set PROMPT2 '... > ' timing x auto set VERBOSITY verbose set HISTFILE ~/.psql_history- :DBNAME set HISTCONTROL ignoredups set COMP_KEYWORD_CASE upper setenv EDITOR 'vim' unset QUIET
  • 22. Parallel workers Workers used for query processing is based on a geometric progression with 3 as common ratio and min_parallel_relation_size as scale factor. Considering the 8MB of default parameter: Size Worker <8 MB 0 <24 MB 1 <72 MB 2 <216 MB 3 <684 MB 4 <1944 MB 5 <5822 MB 6 ... ... Improve query speed @ CPU cost1 max_worker_processes2 max_parallel_workers3 system wide workers for parallel processing <= max_worker_processes max_parallel_workers_per_gather4 query wide workers for parallel processing <= max_parallel_workers Max 4 per our recommendation
  • 23. WAL size growth Five minutes later...  <10  >=10 pg_current_xlog_location pg_current_wal_lsn pg_xlog_location_diff pg_wal_lsn_diff [postgres] # SELECT pg_current_wal_insert_lsn(); pg_current_wal_insert_lsn --------------------------- 3D/B4020A58 (1 row) Time: 13.237 ms [postgres] # SELECT pg_current_wal_insert_lsn(); pg_current_wal_insert_lsn --------------------------- 3E/2203E0F8 (1 row) Time: 7.137 ms [postgres] # SELECT pg_wal_lsn_diff('3E/2203E0F8', '3D/B4020A58'); pg_wal_lsn_diff ----------------- 1845614240 (1 row) Time: 1.041 ms
  • 24.  Conclusions 5 Tools for solving performance issues ce P rofile  An alyse
  • 25. Rep rod  Im prove Not just a fix_it.py , sorry.1 Reproducing in a reliable way is the key.2 A load test can prevent this.3
  • 26. N S • R EXPERIENCE 2019 Thank you!  @nseinlet •  @nseinlet •  @nseinlet •  nse@odoo.com #odooexperience