The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
eZ UnConference - Z Publish top-performance through mastery (and extension) of the cache layers
1. 222 Rond point Ernest Garnier
Immeuble Arche Jacques Cœur
34000 Montpellier
04 99 13 68 60
23/10/2012
eZ UnConference. Oct 2012
EZ PUBLISH TOP-PERFORMANCE
THROUGH MASTERY (AND EXTENSION)
OF THE CACHE LAYERS
Gilles Guirand Gilles Ballini
CTO Kaliop lead engineer Kaliop
eZ Publish board member
@gandbox
1 KALIOP.COM
2. AGENDA
AGENDA
Context
CACHE-BLOCK concepts & Issues
HOWTO build the perfect pagelayout :
0 SQL query (home) / 1 SQL query (others)
never more than 100 template-block files !
save millions of SQL queries
save I/O & Gigabytes of storage
… save the eZ Publish reputation
2
3. 222 Rond point Ernest Garnier
Immeuble Arche Jacques Cœur
34000 Montpellier
04 99 13 68 60
23/10/2012
eZ UnConference. Oct 2012
CONTEXT
3 KALIOP.COM
4. CONTEXT
Sometimes…
EZ Publish produce 30 Gbytes of template-block files
EZ Publish never stop to increase the number of cache files
EZ Publish produce millions of SQL queries per day
EZ Publish crash on cache expiry events (subtree expiry)
EZ Publish crash the hosting (beginning of the war!)
…
4
5. CONTEXT
& Sometimes... the end customer ask
Is it an
eZ Publish kernel issue OR a lack of knowledge from
the developers team ?
Is it sodifficult to manage the eZ Publish cache system ?
All crashes seems to be related to that
Because the GAP between eZ4 & eZ5, is it not the time to
evaluate new CMS competitors ?
5
6. CONTEXT
& most of times... a very huge
optimization is possible in a quick time,
to avoid all theses issues & crashes
especially with the viewcache & the
cache-block settings
6
7. 222 Rond point Ernest Garnier
Immeuble Arche Jacques Cœur
34000 Montpellier
04 99 13 68 60
23/10/2012
eZ UnConference. Oct 2012
CACHE-BLOCK CONCEPTS
& ISSUES
7 KALIOP.COM
8. CACHE-BLOCK
What for ?
Template-block cache = cache
files related to cache-block, also
called « template cache » (
common mistake with the template
compilation )
Template-block cache is an
HTML (or other) cache of a
template part ( cache-block
← Illustration : Łukasz Serwatkahttp://share.ez.no/learn/ez-
publish/ez-publish-performance-optimization-part-3-of-3-practical-
cache-and-template-solutions/(page)/2
8
9. CACHE-BLOCK
Main parameters
KEY value Expiry rules
(none) (none) → 2 hours
expiry=3600
Custom value, array
(none) → on content update
module_result.uri ignore_content_expiry
+
Others ( users, extra ) subtree_expiry=123
subtree_expiry=/news
9
10. CACHE-BLOCK
Most of time, a pagelayout looks like
that (ezdemo exemple) :
{cache-block keys=array( $module_result.uri, $basket_is_empty, $current_user.contentobject_id ,
$extra_cache_key )}
<!-- HEAD / HEADER -->
{cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key )}
<!-- TOP MENU -->
{/cache-block}
{/cache-block}
{$module_result.content}
{cache-block keys=array( $module_result.uri, $user_hash, $access_type.name, $extra_cache_key )}
<!-- FOOTER -->
{/cache-block}
10
11. CACHE-BLOCK
Impact of common parameters
The « URI key » parameter : stupid but
signifiant simulation
{cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key )}
<!-- TOP MENU -->
{/cache-block}
A classic Web site, with 1000 nodes, news folder ( year, month archives ),
products catalog ( filters ), calendar, forum, 2 siteaccess...
Could generate 10 000 « indexable » several URI ( google bot )
A cache-block ( only 1 URI key ) to cache the global menu, who is generating
300 SQL queries
No « expiry » or « ignore_content_expiry » parameters : so the cache-block
expires every 2 hours (or on content publication)
11
12. CACHE-BLOCK
Impact of common parameters
The « URI key » parameter : stupid but signifiant
simulation
So...300 SQL queries * 12 expiration per day *
10 000 URI = 36 millions of SQL queries per
day...
So... 30 000 template-block files
( 3 cache-block )
12
13. CACHE-BLOCK
Easy to say... but how to avoid ?
The « keys » parameter :
Please AVOID :
{cache-block keys=$uri_string} 1 template-block file
... for each URI !!!
{/cache-block}
Use instead :
{cache-block ignore_content_expiry expiry=86400
keys=$my_custom_limited_range_key}
...
Only possible states of your
{/cache-block}
content inside your block
13
14. CACHE-BLOCK
What is the main motivation for using
an URI Key ?
easy for caching values which could be different for each
URI ( title, metas, ezjscore script & css includes,
breadcrumbs, main menu, right column... )
found exemple on ezwebin, ezdemo ( is it not the best
code exemples ? )
working fine on my workstation, so move on
not mypriority, because not visible, i have
IE6/7/8/9/10 CSS issues to resolve first
14
17. 222 Rond point Ernest Garnier
Immeuble Arche Jacques Cœur
34000 Montpellier
04 99 13 68 60
23/10/2012
eZ UnConference. Oct 2012
HOW TO BUILD THE
PERFECT PAGELAYOUT
17 KALIOP.COM
28. PERFECT PAGELAYOUT
Is possible to evaluate the key without a
template operator ?
YES :
keys=first_set( ezpagedata().persistent_variable.js_files,
array('0') )|unique()|asort()
But when a template code is not enough readable, i
still prefer to read PHP
28
29. PERFECT PAGELAYOUT
Am i done ?
NO, use the same logical for the main menu :
FULL : Set your « current section » CSS value, et set
a persistent_variable
Pagelayout : get back your persistent_variable &
use it like a cache-block key Use the same logical for
the right colunm, the footer or whatever which is
more easy to evaluate inside the full view
29
30. PERFECT PAGELAYOUT
Am i done ?
Use the same logical for the right colunm, the
footer or whatever which is more easy to
evaluate inside the full view
30
31. 222 Rond point Ernest Garnier
Immeuble Arche Jacques Cœur
34000 Montpellier
04 99 13 68 60
23/10/2012
eZ UnConference. Oct 2012
CONCLUSION
31 KALIOP.COM
33. CONCLUSION
Conclusion
0 SQL query (home) / 1 SQL query (others)
never more than 100 template-block files !
save millions of SQL queries ( on expiry )
save I/O & Gigabytes of storage
… save the eZ Publish reputation
33