5. Performance
Here's what we can find in the document > body > head of
most 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>
...
6. Performance
Why is it a problem?
BrowserBrowser Max. concurrent connections per domainMax. concurrent connections per domain
Firefox 3+ 6
Opera 12+ 6
Safari 5+ 6
IE 8 6
IE 10 8
Chrome 6
Lack of @aync or @defer makes javascript loading
synchronous.
7. 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 minifies
javascripts and stylesheets in order to reduce the page load
latency. 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)
8. 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 talked
about in the previous topics.
9. Performance
1. A new type of view (QWeb)
2. Asset bundles
3. E-tags for imagesE-tags for images
11. Scalability
What does Odoo provides in terms of scalability?
1. ORM prefetchORM prefetch
# res.partner
companies == 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))
12. Scalability
An ORM lacking prefetch can't provide an efficient SQL
query plan:
-- 1 query - N results
SELECTSELECT ...... FROMFROM res_partner
-- N queries - M results
SELECTSELECT ...... FROMFROM res_partner WHEREWHERE parent_id == <<id>>
-- N*M queries
SELECTSELECT ...... FROMFROM res_country WHEREWHERE id == <<id>>
On 200 companies with ~2 linked partners each would
cause those nested loops to make 601 SQL queries.
In Odoo, the chains of browse record lists allows the ORM
to efficiently plan the same operations in 5 SQL queries
14. Results
Want detailed results, benchmarks and comparison of
performance?
Please attend to the "Open Source CMS: a performance
comparison" talk by Mantavya Gajjar in this room at 16:20.