odoo - cms performances optimization
DESCRIPTION
What has been done in odoo in terms of performance optimization ?TRANSCRIPT
CMS performances optimizationFabien Meghazi
PerformanceRefers to the capability of a system to provide a
certain response time.
Performance
What has been done in odoo in terms of performanceoptimization ?
Performance
1. A new type of view (QWeb)
2. Asset bundlesAsset bundles
Performance
Here's what we can find in the document > body > head ofmost CMS's default setup.
<head><head> <link<link href="/files/css/css_pbm0lsQQJ7A7WCCIMgxLho6mI_kBNgznNUWmTWcnfoE.css" type="text/css" rel="stylesheet" <link<link href="/files/css/css_GgerrJ1eO2p2FAGV0vkRGdFa8QLXDr0-mUgvpPQTbXU.css" type="text/css" rel="stylesheet" <link<link href="/files/css/css_GLOpzAhXMtWYvS4h5wbl6MtSyjZs8gh4uS0H2yCFKMQ.css" type="text/css" rel="stylesheet" <link<link href="/files/css/css_FA2n7wdGXAxEt6RZrMKCEcj3lLJtYSo_M5fkYjNGzYY.css" type="text/css" rel="stylesheet" <link<link href="/files/css/css_BxX7fMKqodl8G9DZ2zEO8tz0u1pex3OS77VssQ6kAbs.css" type="text/css" rel="stylesheet" <script <script src="/files/js/js_xAPl0qIk9eowy_iS9tNkCWXLUVoat94SQT48UBCFkyQ.js" type="text/javascript"></script>></script> <script <script src="/files/js/js_pWaEh3PAhCcBT2MOtrKzosTxS9eM5SUYFirhq9KQa0M.js" type="text/javascript"></script>></script> <script <script src="/files/js/js_sqDzf_5suPJcQpKY1lVF0I5wO_5bUrj5RwpiTKV3w3o.js" type="text/javascript"></script>></script> <script <script src="/files/js/js_TA8qfKqSlPTRUeVEmNo6g-LK6_BQOwPCT-lpp_13vP8.js" type="text/javascript"></script>></script> <script <script src="/files/js/js_rv_BKYv7yieH0IgHddhWHDC-bWGan8yiJbusyOpr0mw.js" type="text/javascript"></script>></script> <script <script src="/files/js/js_fZbsGtwY7jnTvjaAvTzUEFJKO-FkHlZC6o1x2O_56wc.js" type="text/javascript"></script>></script> ...
Performance
Why is it a problem?
BrowserBrowser Max. concurrent connections per domainMax. concurrent connections per domainFirefox 3+ 6Opera 12+ 6Safari 5+ 6IE 8 6IE 10 8Chrome 6
Lack of @aync or @defer makes javascript loadingsynchronous.
Performance
Solved by asset bundles!
<head><head> <link<link href="/web/css/website.assets_frontend" rel="stylesheet"/>/> <script <script src="/web/js/website.assets_frontend"></script>></script>
An asset bundle automatically concatenates and minifiesjavascripts and stylesheets in order to reduce the page loadlatency. Of course, once a bundle is generated, it's cached.
<script <script src="/web/js/website.assets_frontend/da39a3e"></script>></script>
Versioned bundles (still to be merged in master for v8)
Performance
Asset bundles are Odoo views too (ir.ui.view) !
<template<template id="my_theme" inherit_id="website.assets_frontend">><xpath<xpath expr="." position="inside">> <script<script src="/my_theme/static/src/js/my_theme.js"></script>></script> <link<link href="/my_theme/static/src/css/my_theme.css" rel="stylesheet"/>/></xpath></xpath></template></template>
As such, they benefit of all the advantages we just talkedabout in the previous topics.
Performance
1. A new type of view (QWeb)
2. Asset bundles
3. E-tags for imagesE-tags for images
ScalabilityAbility of a system to handle a growing amount of
work in a capable manner.
Scalability
What does Odoo provides in terms of scalability?
1. ORM prefetchORM prefetch
# res.partnercompanies == self..search([(([('is_company',,'=',,True)]))])forfor company inin companies:: forfor contact inin company..child_ids:: ifif contact..country_id:: printprint u"%s : %s" %% ((contact..name,, contact..country_id..name))
Scalability
An ORM lacking prefetch can't provide an efficient SQLquery plan:
-- 1 query - N resultsSELECTSELECT ...... FROMFROM res_partner
-- N queries - M resultsSELECTSELECT ...... FROMFROM res_partner WHEREWHERE parent_id == <<id>>
-- N*M queriesSELECTSELECT ...... FROMFROM res_country WHEREWHERE id == <<id>>
On 200 companies with ~2 linked partners each wouldcause those nested loops to make 601 SQL queries.
In Odoo, the chains of browse record lists allows the ORMto efficiently plan the same operations in 5 SQL queries
Scalability
1. ORM prefetch
2. Preforked workers (same as Gunicorn)Preforked workers (same as Gunicorn)
Results
Want detailed results, benchmarks and comparison ofperformance?
Please attend to the "Open Source CMS: a performancecomparison" talk by Mantavya Gajjar in this room at 16:20.
Questions ?
Thanks for listening !