SlideShare a Scribd company logo
High Performance
Drupal Web Sites

360°
jbguerraz@skilld.fr
Who's that punk ?!
●

●

●

A French nerd !
Used to manage complex IT projects for the
last 10 years
And many more nights on performances
issues

●

... :)

... who just created his own company
Summary








Cache
Upload & Download
Browser rendering
Compression
Drupal pages architecture
Analyze
Cache
What should we cache ?
EVERY POSSIBLE THING !!!
●

PHP (opcode)

●

Computations (functions results)

●

Datas (views, DB requests)

●

Entities & Fields (nodes, comments, taxonomy terms, user profiles,…)

●

Images (imagecache/styles)

●

HTML (page, block, panel, pane, views)

●

Any static ressource (CSS, JS, SWF, SVG, PDF, ZIP, Video, Sound, …)

jbguerraz@skilld.fr
Cache
How should we cache ?
PHP (opcode) :
●
●

// allocate one segment of 32Mb
apc.shm_segments=1
apc.shm_size=32
// do not check if php file was updated
apc.stat= 0

APC
Eaccelerator (a bit faster,
seg fault)

jbguerraz@skilld.fr

// never expire
apc.ttl = 0
// use kernel anonymous memory
apc.mmap_file_mask = /dev/zero.
Cache
How should we cache ?
function mymodule_complex_calculation_crazy_cache() {
static $cache ;
Computations (functions results) :
if (isset($cache)) {
return $cache ;
}
($cache = &drupal_static(__FUNCTION__)) {
●
drupal_static (sometime static if big ifreturn $cache;
amount of calls within a page load) }
if ($cache = cache_get('my_cache_item', 'my_cache_bin')) {
$cache = $cache->data;
}
●
cache_set / cache_get (use your own else {
heavy calculations that kills
bin if lot of data to store and/or need // some = complex_calculation(); kitten
$cache
cache_set('my_cache_item', $cache, 'my_cache_bin');
more control over your cache)
}
return $cache ;
}

jbguerraz@skilld.fr
Cache
How should we cache ?
Datas (views, DB requests) :
●

Views cache

●

Views per user cache

●

Note :
A custom cache bin require, at
module install, to create a new cache
table using the same schema as core
cache tables (see table below).
Copy/paste from :
includes/system.install

Field

Type

Null

cid

Own cache bin for DB requests (if
somehow there is a good reason
to request DB directly)

varchar(255)

no

data

longblob

yes

expire

int

no

created

int

no

headers

text

yes

serialized smallint

jbguerraz@skilld.fr

no
Cache
How should we cache ?
Entities (nodes, comments, taxonomy terms,
user profiles,…) :
Entity cache
Entity cache
seconds

●

Load 1 000 users
50
45
40
35
30
25
20
15
10
5
0

First load
Next loads

No entity cache

jbguerraz@skilld.fr

Entity cache
Cache
How should we cache ?
Images (imagecache/styles) :
●

ImageCache

●

ImageCache External

jbguerraz@skilld.fr
Cache
How should we cache ?
HTML (page, block, panel, pane, views) :
●

Panels Page Cache

●

Panels Hash Cache

●

Varnish

●

Varnish ESI

jbguerraz@skilld.fr
Cache
How should we cache ?
Any static ressource (CSS, JS, SWF, SVG,
PDF, ZIP, Video, Sound, …) :
●

Varnish

●

Nginx

●

CDN far-future

jbguerraz@skilld.fr
Cache
What cache backends ?

http://janezurevc.name/static/bcn_cache

jbguerraz@skilld.fr
Cache
What about cache invalidation ?
●

Cache actions

●

Cachetags

●

Views content cache

●

Expire

●

Entity cache flusher

jbguerraz@skilld.fr
Upload & Download
Cookie free domains
CDN module in order to use static resources
dedicated domain(s) which differ from main
domain (for instance, static.mysite.com)
$cookie_domain have to be set to main domain in
settings.php (for instance www.mysite.com)

jbguerraz@skilld.fr
Upload & Download
Aggregates
JS (Advanced aggregate)
●
CSS (Advanced aggregate)
●
Images & CSS (CSS
embeded image)
●
Images (spritesheets)
●

jbguerraz@skilld.fr

Note :
Sprites are now obselete, use CSS
embeded image instead
(for IE, images <32Kb can be
embeded)
Upload & Download
Parrallelization
CDN (URL
sharding)
●
Head.js
●
Yepnopejs
●

CSS

(Interesting but not yet drupal integrated)

JS

jbguerraz@skilld.fr
Browser rendering
JS
●

Rendering sequence : request as soon as it
parse
●

●

JS in footer scope

Head.js / lab.js (defer)

jbguerraz@skilld.fr
Browser rendering
CSS
Translate3D, no DOM position change
●
Pay attention to selectors performances ! No
CSS3 selectors (great but slow)
●
Avoid blinking > no JS to hide an element on
load, hide by CSS and show from JS
(perception matters!)
●

jbguerraz@skilld.fr
Compression
What should we compress ?
Images
●
CSS
●
JS
●
HTML
●
«Any» static file
●

jbguerraz@skilld.fr
Compression
How should we compress ?
Images
●

Imageapi optimize
●

jpegtran

●

advpng

jbguerraz@skilld.fr
Compression
How should we compress ?
CSS
Advagg CSS compress
●
CSS Compressor
●

●

●

faster than CSSTidy

gzip

jbguerraz@skilld.fr
Compression
How should we compress ?
JS
Advagg JS compress
●
JSMin
●

●

●

faster than JSMin+

Gzip

jbguerraz@skilld.fr
Compression
How should we compress ?
HTML
●

Gzip

jbguerraz@skilld.fr
Compression
How should we compress ?
Any static files
●

Gzip

jbguerraz@skilld.fr
Drupal pages architecture
How to build a performant page ?
USE AS FEW MODULES AS POSSIBLE !
Search_api (solr, mongo)
●Mongodb
●Redis
●Memcache
●Elysia cron
●

Panels
●Panels everywhere
●Views
●Rules
●Entities
●

jbguerraz@skilld.fr
Drupal pages architecture
Why homogeneity maters ?
Blocks, panes, pick one !
One single way of managing « blocks » helps
using ESI caching for instance; it also makes
easier the cache invalidation management for
these «blocks».
Keep it simple : one API to implement

jbguerraz@skilld.fr
Analyze
Browser level
Gtmetrix.com
●
Yslow
●
Firebug
●
Chrome / Safari developer tools
●
Whichloadsfaster.com
●

jbguerraz@skilld.fr
Analyze
Drupal level
Devel
●
Watchdog (redirected to syslog if needed on live
server)
●

jbguerraz@skilld.fr
Analyze
PHP level
FirePHP / ChromePHP
●
Xhprof (eventually in addition to Xdebug)
●
PHP error log
●
PHP-FPM slow logs
●
MySQL Slow query logs
●

jbguerraz@skilld.fr
Analyze
System level
strace
●
tcpdump & wireshark
●

jbguerraz@skilld.fr
Spasibo bolshoe !
Your time now, any question ?

Wanna get these slides ?
Search for jbguerraz on Slideshare ;)

jbguerraz@skilld.fr

More Related Content

What's hot

Javascript basics
Javascript basicsJavascript basics
Javascript basics
Falcon2018
 
Gutenberg Extended
Gutenberg ExtendedGutenberg Extended
Gutenberg Extended
Sören Wrede
 
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
Mario Heiderich
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the Browser
FITC
 
Be German About Your Frontend
Be German About Your FrontendBe German About Your Frontend
Be German About Your FrontendArush Sehgal
 
bongaus.fi - Spotting Service Powered by Django
bongaus.fi - Spotting Service Powered by Djangobongaus.fi - Spotting Service Powered by Django
bongaus.fi - Spotting Service Powered by Django
Juho Vepsäläinen
 

What's hot (6)

Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Gutenberg Extended
Gutenberg ExtendedGutenberg Extended
Gutenberg Extended
 
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the Browser
 
Be German About Your Frontend
Be German About Your FrontendBe German About Your Frontend
Be German About Your Frontend
 
bongaus.fi - Spotting Service Powered by Django
bongaus.fi - Spotting Service Powered by Djangobongaus.fi - Spotting Service Powered by Django
bongaus.fi - Spotting Service Powered by Django
 

Viewers also liked

Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances Drupal
Skilld
 
Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8Skilld
 
[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) Government[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) GovernmentDrupal Taiwan
 
Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !
Skilld
 
Drupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptesDrupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptes
Skilld
 
Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8
Skilld
 

Viewers also liked (6)

Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances Drupal
 
Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8Lviv 2013 d7 vs d8
Lviv 2013 d7 vs d8
 
[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) Government[DCTPE2010] Drupal & (Open/Anti) Government
[DCTPE2010] Drupal & (Open/Anti) Government
 
Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !Retrospective 2013 de Drupal !
Retrospective 2013 de Drupal !
 
Drupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptesDrupal, les hackers, la sécurité & les (très) grands comptes
Drupal, les hackers, la sécurité & les (très) grands comptes
 
Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8Retrospective 2013 de la communauté Drupal 8
Retrospective 2013 de la communauté Drupal 8
 

Similar to Drupal Camp Kiev 2012 - High Performance Drupal Web Sites

Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesDrupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesJean-Baptiste Guerraz
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
Alive Kuo
 
New Ranking Metrics by Google
New Ranking Metrics by GoogleNew Ranking Metrics by Google
New Ranking Metrics by Google
Phil Marx
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
Women in Technology Poland
 
Drupalcamp performance
Drupalcamp performanceDrupalcamp performance
Drupalcamp performance
Frontkom
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
Women in Technology Poland
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Per Henrik Lausten
 
2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million
Омские ИТ-субботники
 
Neoito — How modern browsers work
Neoito — How modern browsers workNeoito — How modern browsers work
Neoito — How modern browsers work
Neoito
 
2016 stop writing javascript frameworks by Joe Gregorio
2016 stop writing javascript frameworks by Joe Gregorio2016 stop writing javascript frameworks by Joe Gregorio
2016 stop writing javascript frameworks by Joe Gregorio
David Zapateria Besteiro
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
Jorg Janke
 
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Skilld
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and ResourcesRon Reiter
 
Developing word press professionally
Developing word press professionallyDeveloping word press professionally
Developing word press professionally
Austin Gil
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsAndrew Ferrier
 
My tools for sfdc developer
My tools for sfdc developerMy tools for sfdc developer
My tools for sfdc developer
EXIAHUANG
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
David Amend
 
Using JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile ApplicationsUsing JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile Applications
Derek Anderson
 

Similar to Drupal Camp Kiev 2012 - High Performance Drupal Web Sites (20)

Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web SitesDrupal Camp Kiev 2012 - High Performance Drupal Web Sites
Drupal Camp Kiev 2012 - High Performance Drupal Web Sites
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
Performance (browser)
Performance (browser)Performance (browser)
Performance (browser)
 
New Ranking Metrics by Google
New Ranking Metrics by GoogleNew Ranking Metrics by Google
New Ranking Metrics by Google
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
Drupalcamp performance
Drupalcamp performanceDrupalcamp performance
Drupalcamp performance
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)
 
2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million2016-01-16 03 Денис Нелюбин. How to test a million
2016-01-16 03 Денис Нелюбин. How to test a million
 
Neoito — How modern browsers work
Neoito — How modern browsers workNeoito — How modern browsers work
Neoito — How modern browsers work
 
2016 stop writing javascript frameworks by Joe Gregorio
2016 stop writing javascript frameworks by Joe Gregorio2016 stop writing javascript frameworks by Joe Gregorio
2016 stop writing javascript frameworks by Joe Gregorio
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and Resources
 
Developing word press professionally
Developing word press professionallyDeveloping word press professionally
Developing word press professionally
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web Applications
 
My tools for sfdc developer
My tools for sfdc developerMy tools for sfdc developer
My tools for sfdc developer
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
 
Using JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile ApplicationsUsing JavaScript to write Native Mobile Applications
Using JavaScript to write Native Mobile Applications
 

More from Skilld

201910 skilld presentation-societe
201910 skilld presentation-societe201910 skilld presentation-societe
201910 skilld presentation-societe
Skilld
 
Session Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses étatsSession Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses états
Skilld
 
Case study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec DrupalCase study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec Drupal
Skilld
 
Lviv eurodrupalcamp 2015 - drupal contributor howto
Lviv eurodrupalcamp 2015  - drupal contributor howtoLviv eurodrupalcamp 2015  - drupal contributor howto
Lviv eurodrupalcamp 2015 - drupal contributor howto
Skilld
 
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Skilld
 
Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances Drupal
Skilld
 

More from Skilld (6)

201910 skilld presentation-societe
201910 skilld presentation-societe201910 skilld presentation-societe
201910 skilld presentation-societe
 
Session Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses étatsSession Drupagora 2019 - Agilité dans tous ses états
Session Drupagora 2019 - Agilité dans tous ses états
 
Case study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec DrupalCase study : 2 applications mobiles réalisées avec Drupal
Case study : 2 applications mobiles réalisées avec Drupal
 
Lviv eurodrupalcamp 2015 - drupal contributor howto
Lviv eurodrupalcamp 2015  - drupal contributor howtoLviv eurodrupalcamp 2015  - drupal contributor howto
Lviv eurodrupalcamp 2015 - drupal contributor howto
 
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
 
Drupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances DrupalDrupagora 2012 Optimisation performances Drupal
Drupagora 2012 Optimisation performances Drupal
 

Recently uploaded

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 

Recently uploaded (20)

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 

Drupal Camp Kiev 2012 - High Performance Drupal Web Sites

  • 1. High Performance Drupal Web Sites 360° jbguerraz@skilld.fr
  • 2. Who's that punk ?! ● ● ● A French nerd ! Used to manage complex IT projects for the last 10 years And many more nights on performances issues ● ... :) ... who just created his own company
  • 3. Summary       Cache Upload & Download Browser rendering Compression Drupal pages architecture Analyze
  • 4. Cache What should we cache ? EVERY POSSIBLE THING !!! ● PHP (opcode) ● Computations (functions results) ● Datas (views, DB requests) ● Entities & Fields (nodes, comments, taxonomy terms, user profiles,…) ● Images (imagecache/styles) ● HTML (page, block, panel, pane, views) ● Any static ressource (CSS, JS, SWF, SVG, PDF, ZIP, Video, Sound, …) jbguerraz@skilld.fr
  • 5. Cache How should we cache ? PHP (opcode) : ● ● // allocate one segment of 32Mb apc.shm_segments=1 apc.shm_size=32 // do not check if php file was updated apc.stat= 0 APC Eaccelerator (a bit faster, seg fault) jbguerraz@skilld.fr // never expire apc.ttl = 0 // use kernel anonymous memory apc.mmap_file_mask = /dev/zero.
  • 6. Cache How should we cache ? function mymodule_complex_calculation_crazy_cache() { static $cache ; Computations (functions results) : if (isset($cache)) { return $cache ; } ($cache = &drupal_static(__FUNCTION__)) { ● drupal_static (sometime static if big ifreturn $cache; amount of calls within a page load) } if ($cache = cache_get('my_cache_item', 'my_cache_bin')) { $cache = $cache->data; } ● cache_set / cache_get (use your own else { heavy calculations that kills bin if lot of data to store and/or need // some = complex_calculation(); kitten $cache cache_set('my_cache_item', $cache, 'my_cache_bin'); more control over your cache) } return $cache ; } jbguerraz@skilld.fr
  • 7. Cache How should we cache ? Datas (views, DB requests) : ● Views cache ● Views per user cache ● Note : A custom cache bin require, at module install, to create a new cache table using the same schema as core cache tables (see table below). Copy/paste from : includes/system.install Field Type Null cid Own cache bin for DB requests (if somehow there is a good reason to request DB directly) varchar(255) no data longblob yes expire int no created int no headers text yes serialized smallint jbguerraz@skilld.fr no
  • 8. Cache How should we cache ? Entities (nodes, comments, taxonomy terms, user profiles,…) : Entity cache Entity cache seconds ● Load 1 000 users 50 45 40 35 30 25 20 15 10 5 0 First load Next loads No entity cache jbguerraz@skilld.fr Entity cache
  • 9. Cache How should we cache ? Images (imagecache/styles) : ● ImageCache ● ImageCache External jbguerraz@skilld.fr
  • 10. Cache How should we cache ? HTML (page, block, panel, pane, views) : ● Panels Page Cache ● Panels Hash Cache ● Varnish ● Varnish ESI jbguerraz@skilld.fr
  • 11. Cache How should we cache ? Any static ressource (CSS, JS, SWF, SVG, PDF, ZIP, Video, Sound, …) : ● Varnish ● Nginx ● CDN far-future jbguerraz@skilld.fr
  • 12. Cache What cache backends ? http://janezurevc.name/static/bcn_cache jbguerraz@skilld.fr
  • 13. Cache What about cache invalidation ? ● Cache actions ● Cachetags ● Views content cache ● Expire ● Entity cache flusher jbguerraz@skilld.fr
  • 14. Upload & Download Cookie free domains CDN module in order to use static resources dedicated domain(s) which differ from main domain (for instance, static.mysite.com) $cookie_domain have to be set to main domain in settings.php (for instance www.mysite.com) jbguerraz@skilld.fr
  • 15. Upload & Download Aggregates JS (Advanced aggregate) ● CSS (Advanced aggregate) ● Images & CSS (CSS embeded image) ● Images (spritesheets) ● jbguerraz@skilld.fr Note : Sprites are now obselete, use CSS embeded image instead (for IE, images <32Kb can be embeded)
  • 16. Upload & Download Parrallelization CDN (URL sharding) ● Head.js ● Yepnopejs ● CSS (Interesting but not yet drupal integrated) JS jbguerraz@skilld.fr
  • 17. Browser rendering JS ● Rendering sequence : request as soon as it parse ● ● JS in footer scope Head.js / lab.js (defer) jbguerraz@skilld.fr
  • 18. Browser rendering CSS Translate3D, no DOM position change ● Pay attention to selectors performances ! No CSS3 selectors (great but slow) ● Avoid blinking > no JS to hide an element on load, hide by CSS and show from JS (perception matters!) ● jbguerraz@skilld.fr
  • 19. Compression What should we compress ? Images ● CSS ● JS ● HTML ● «Any» static file ● jbguerraz@skilld.fr
  • 20. Compression How should we compress ? Images ● Imageapi optimize ● jpegtran ● advpng jbguerraz@skilld.fr
  • 21. Compression How should we compress ? CSS Advagg CSS compress ● CSS Compressor ● ● ● faster than CSSTidy gzip jbguerraz@skilld.fr
  • 22. Compression How should we compress ? JS Advagg JS compress ● JSMin ● ● ● faster than JSMin+ Gzip jbguerraz@skilld.fr
  • 23. Compression How should we compress ? HTML ● Gzip jbguerraz@skilld.fr
  • 24. Compression How should we compress ? Any static files ● Gzip jbguerraz@skilld.fr
  • 25. Drupal pages architecture How to build a performant page ? USE AS FEW MODULES AS POSSIBLE ! Search_api (solr, mongo) ●Mongodb ●Redis ●Memcache ●Elysia cron ● Panels ●Panels everywhere ●Views ●Rules ●Entities ● jbguerraz@skilld.fr
  • 26. Drupal pages architecture Why homogeneity maters ? Blocks, panes, pick one ! One single way of managing « blocks » helps using ESI caching for instance; it also makes easier the cache invalidation management for these «blocks». Keep it simple : one API to implement jbguerraz@skilld.fr
  • 27. Analyze Browser level Gtmetrix.com ● Yslow ● Firebug ● Chrome / Safari developer tools ● Whichloadsfaster.com ● jbguerraz@skilld.fr
  • 28. Analyze Drupal level Devel ● Watchdog (redirected to syslog if needed on live server) ● jbguerraz@skilld.fr
  • 29. Analyze PHP level FirePHP / ChromePHP ● Xhprof (eventually in addition to Xdebug) ● PHP error log ● PHP-FPM slow logs ● MySQL Slow query logs ● jbguerraz@skilld.fr
  • 30. Analyze System level strace ● tcpdump & wireshark ● jbguerraz@skilld.fr
  • 31. Spasibo bolshoe ! Your time now, any question ? Wanna get these slides ? Search for jbguerraz on Slideshare ;) jbguerraz@skilld.fr

Editor's Notes

  1. {}