SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
“Symfony2  &  eZ  Publish  5  jouent  à  Cache  Cache”
Transparent	
  Caching	
  &	
  Context	
  aware	
  HTTP	
  Cache
PHPTour  Lyon  2014  Lightning  talk,  Presented  by  Bertrand  Dunogier  &  André  Rømcke  
Expanded  for  Online  consumpQon
About	
  eZ
•eZ	
  Systems	
  AS	
  :	
  	
  ez.no	
  
•Used	
  PHP	
  since	
  the	
  start	
  in	
  1999	
  
•Offices	
  in:	
  Lyon,	
  Paris,	
  New	
  York,	
  Oslo,	
  Skien,	
  Köln,	
  Katowice,	
  Tokyo,	
  +	
  suppliers	
  
•Partners:	
  100+	
  spread	
  across	
  Europe,	
  America	
  and	
  Asia	
  
•Customers:	
  500+	
  (EMI,	
  Orange,	
  Canal+,	
  Financial	
  Times,	
  Madsack,	
  ..)	
  
!
•eZ	
  Publish	
  v5.x	
  :	
  	
  hQps://github.com/ezsystems/ezpublish-­‐community	
  
•5.x	
  is	
  Dual	
  Kernel:	
  
•“PlaWorm”:	
  Symfony2,	
  Doctrine,	
  Stash..	
  +	
  Future	
  proof	
  Public	
  API’s	
  
•“Legacy”:	
  Latests	
  version	
  of	
  kernel	
  that	
  has	
  powered	
  eZ	
  Publish	
  since	
  v3.0	
  (2001)	
  
•Flexible:	
  content	
  model,	
  workflows,	
  permission	
  system,	
  ..	
  everything..	
  
•Many	
  web-­‐features	
  out	
  of	
  the	
  box	
  “making	
  your	
  life	
  easier”	
  
•Code	
  &	
  Data	
  BC	
  kept	
  since	
  v3.0,	
  so@	
  code	
  migraeon	
  from	
  “legacy”	
  to	
  “PlaWorm”	
  
unel	
  2019	
  using	
  last	
  LTS	
  release
2With new UI as “eZ Platform”, early alpha summer 2014!
Transparent	
  cache?
Transparent	
  cache?
•Not	
  visible	
  to	
  End-­‐,	
  Editor-­‐,	
  Admin-­‐User:	
  “Content	
  always*	
  fresh”	
  
•Not	
  visible	
  to	
  Developer:	
  By	
  using	
  predefined	
  API	
  &	
  extension	
  points	
  
• Almost,	
  we’ll	
  get	
  back	
  to	
  this	
  one..





















*	
  Recommended	
  purge	
  strategy	
  with	
  Varnish	
  will	
  mark	
  cache	
  as	
  expired	
  but	
  keep	
  serving	
  the	
  stale	
  content	
  
unMl	
  cache	
  is	
  refreshed	
  from	
  backend,	
  this	
  is	
  a	
  must	
  for	
  high	
  traffic	
  scenarios.
4
What	
  kind	
  of	
  cache	
  are	
  we	
  talking	
  about	
  here?
Example	
  of	
  app	
  with	
  transparent	
  cache:	
  eZ	
  Publish	
  PlaBorm
6
“Context	
  aware”	
  
HTTP	
  Cache
Persistence	
  
(DB	
  access)
Benefit	
  for	
  developers
Benefit	
  for	
  developers
	
  	
  	
  	
  	
  	
  	
  	
  //	
  Create	
  a	
  new	
  Content	
  drag	
  for	
  the	
  what	
  we	
  want	
  to	
  update	
  
	
  	
  	
  	
  	
  	
  	
  	
  $drag	
  =	
  $contentService-­‐>createContentDrag(

	
  	
  	
  	
  	
  	
  	
  	
  $contentService-­‐>loadContentInfo(15042)

	
  	
  	
  	
  );

	
  	
  	
  	
  	
  	
  	
  	
  //	
  Set	
  a	
  new	
  etle	
  
	
  	
  	
  	
  	
  	
  	
  	
  $struct	
  =	
  $contentService-­‐>newContentUpdateStruct();	
  
	
  	
  	
  	
  	
  	
  	
  	
  $struct-­‐>setField('etle',	
  ‘PHP	
  in	
  2015:	
  ZendPHPng	
  vs	
  HHVM');

	
  	
  	
  	
  	
  	
  	
  	
  	
  //	
  Update	
  and	
  publish	
  the	
  Content	
  drag	
  
	
  	
  	
  	
  	
  	
  	
  	
  $drag	
  =	
  $contentService-­‐>updateContent($drag-­‐>versionInfo,	
  $struct);	
  
	
  	
  	
  	
  	
  	
  	
  	
  $contentService-­‐>publishVersion($drag-­‐>versionInfo);
8
=	
  No	
  code	
  dealing	
  with	
  cache	
  (in	
  your	
  business	
  logic)
But	
  lets	
  focus	
  on	
  HTTP	
  Cache,	
  what	
  makes	
  this	
  work?
Context	
  Aware	
  HTTP	
  Cache	
  takes	
  HTTP	
  Headers	
  as	
  context	
  info
10
X-­‐LocaQon-­‐Id:  42
X-­‐LocaQon-­‐Id:  2

Vary:  X-­‐User-­‐Hash
Unique	
  idenQfier	
  for	
  Purge	
  needs
Vary	
  Cache	
  per	
  
User	
  Rights
How	
  to	
  use	
  this	
  in	
  controllers?
Custom	
  controller	
  example:	
  Menu	
  Controller
	
  	
  	
  /**	
  
	
  	
  	
  	
  	
  *	
  Renders	
  the	
  top	
  menu,	
  with	
  cache	
  control	
  
	
  	
  	
  	
  	
  *	
  @return	
  SymfonyComponentHQpFoundaeonResponse	
  
	
  	
  	
  	
  	
  */	
  
	
  	
  	
  	
  public	
  funceon	
  topMenuAceon()	
  
	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  //	
  Get	
  root	
  locaeon	
  id	
  for	
  current	
  site	
  
	
  	
  	
  	
  	
  	
  	
  	
  $rootLocaeonId	
  =	
  $this-­‐>getConfigResolver()-­‐>getParameter('content.tree_root.locaeon_id');

	
  	
  	
  	
  	
  	
  	
  	
  //	
  Sewng	
  HTTP	
  cache	
  for	
  the	
  response	
  to	
  be	
  public	
  and	
  with	
  a	
  TTL	
  of	
  1	
  day.	
  
	
  	
  	
  	
  	
  	
  	
  	
  $response	
  =	
  new	
  Response;	
  
	
  	
  	
  	
  	
  	
  	
  	
  $response-­‐>setPublic();	
  
	
  	
  	
  	
  	
  	
  	
  	
  $response-­‐>setSharedMaxAge(86400);

	
  	
  	
  	
  	
  	
  	
  	
  //	
  Menu	
  will	
  expire	
  when	
  top	
  locaeon	
  cache	
  is	
  purged.	
  
	
  	
  	
  	
  	
  	
  	
  	
  $response-­‐>headers-­‐>set('X-­‐Locaeon-­‐Id',	
  $rootLocaeonId);

	
  	
  	
  	
  	
  	
  	
  	
  //	
  Menu	
  might	
  vary	
  depending	
  on	
  user	
  permissions,	
  so	
  make	
  the	
  cache	
  vary	
  on	
  the	
  user	
  hash.	
  
	
  	
  	
  	
  	
  	
  	
  	
  $response-­‐>setVary('X-­‐User-­‐Hash');
12
Example:	
  Behind	
  the	
  scenes	
  when	
  publishing	
  content
Example:	
  Behind	
  the	
  scenes	
  when	
  Publishing	
  Content
•For	
  affected	
  Content:	
  
•Clear	
  Persistence	
  cache	
  
•Purge	
  (Stale)	
  HTTP	
  caches	
  using	
  X-­‐Locaeon-­‐id	
  (the	
  “placement(s)”	
  of	
  a	
  
Content	
  object)	
  across	
  all	
  User	
  variants	
  
•By	
  configuraeon:	
  
•Opeonal	
  rules	
  for	
  addieonal	
  HTTP	
  caches	
  to	
  clear	
  (Content	
  Relaeons,	
  
Locaeon	
  Children,	
  Locaeon	
  Parent,	
  ..),	
  useful	
  when	
  inline	
  rendering	
  is	
  
used	
  instead	
  of	
  only	
  ESI
14
Fin:	
  Thats	
  it!
•Recently:	
  
•Collaboraeon	
  with	
  JoliCode	
  and	
  FOS	
  community	
  brought	
  context	
  aware	
  
caching	
  to	
  FOSHQpCacheBundle	
  
!
•Next	
  up:	
  
•Plan	
  to	
  parecipate	
  more	
  acevely	
  further	
  on	
  adding	
  more	
  features	
  
•Start	
  to	
  use	
  in	
  eZ	
  Publish	
  PlaWorm	
  
!
•TL;DR;	
  Use	
  FOSHQpCacheBundle	
  or	
  use	
  eZ	
  Publish	
  PlaWorm	
  which	
  
does	
  all	
  of	
  this	
  for	
  you	
  ;)
15

Contenu connexe

Tendances

Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday DeveloperRoss Tuck
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in PracticeNoah Davis
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天tblanlan
 
Test complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerTest complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerGiuseppe Maxia
 
Vancouver presentation
Vancouver presentationVancouver presentation
Vancouver presentationColleen_Murphy
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryWilliam Candillon
 
So you want to liberate your data?
So you want to liberate your data?So you want to liberate your data?
So you want to liberate your data?Mogens Heller Grabe
 
Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Itamar Haber
 
神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)guregu
 
Terraform, Ansible, or pure CloudFormation?
Terraform, Ansible, or pure CloudFormation?Terraform, Ansible, or pure CloudFormation?
Terraform, Ansible, or pure CloudFormation?geekQ
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUNCong Zhang
 
Terraform, Ansible or pure CloudFormation
Terraform, Ansible or pure CloudFormationTerraform, Ansible or pure CloudFormation
Terraform, Ansible or pure CloudFormationgeekQ
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)Felix Geisendörfer
 
MySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELKMySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELKI Goo Lee
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScriptQiangning Hong
 
PuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbqueryPuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbqueryPuppet
 

Tendances (20)

Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天
 
Test complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerTest complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployer
 
Vancouver presentation
Vancouver presentationVancouver presentation
Vancouver presentation
 
Caching. api. http 1.1
Caching. api. http 1.1Caching. api. http 1.1
Caching. api. http 1.1
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQuery
 
So you want to liberate your data?
So you want to liberate your data?So you want to liberate your data?
So you want to liberate your data?
 
Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)
 
XQuery in the Cloud
XQuery in the CloudXQuery in the Cloud
XQuery in the Cloud
 
神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)神に近づくx/net/context (Finding God with x/net/context)
神に近づくx/net/context (Finding God with x/net/context)
 
Terraform, Ansible, or pure CloudFormation?
Terraform, Ansible, or pure CloudFormation?Terraform, Ansible, or pure CloudFormation?
Terraform, Ansible, or pure CloudFormation?
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Terraform, Ansible or pure CloudFormation
Terraform, Ansible or pure CloudFormationTerraform, Ansible or pure CloudFormation
Terraform, Ansible or pure CloudFormation
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)
 
MySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELKMySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELK
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript
 
PuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbqueryPuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbquery
 
harry presentation
harry presentationharry presentation
harry presentation
 

En vedette

Stop multiplying by 4 PHP Tour 2014
Stop multiplying by 4 PHP Tour 2014Stop multiplying by 4 PHP Tour 2014
Stop multiplying by 4 PHP Tour 2014Chuck Reeves
 
Click and deploy - Continuous delivery avec Zend Server et Jenknins
Click and deploy - Continuous delivery avec Zend Server et JenkninsClick and deploy - Continuous delivery avec Zend Server et Jenknins
Click and deploy - Continuous delivery avec Zend Server et JenkninsSophie Beaupuis
 
Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...
Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...
Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...Nicolas Silberman
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014André Rømcke
 

En vedette (6)

Stop multiplying by 4 PHP Tour 2014
Stop multiplying by 4 PHP Tour 2014Stop multiplying by 4 PHP Tour 2014
Stop multiplying by 4 PHP Tour 2014
 
python
pythonpython
python
 
Click and deploy - Continuous delivery avec Zend Server et Jenknins
Click and deploy - Continuous delivery avec Zend Server et JenkninsClick and deploy - Continuous delivery avec Zend Server et Jenknins
Click and deploy - Continuous delivery avec Zend Server et Jenknins
 
Faster develoment with CakePHP 3
Faster develoment with CakePHP 3Faster develoment with CakePHP 3
Faster develoment with CakePHP 3
 
Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...
Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...
Industrialisation des environnements de dev avec Puppet et Amazon (mais en fa...
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014
 

Similaire à PhpTour Lyon 2014 - Transparent caching & context aware http cache

OpenStack APIs: Present and Future (Beta Talk)
OpenStack APIs: Present and Future (Beta Talk)OpenStack APIs: Present and Future (Beta Talk)
OpenStack APIs: Present and Future (Beta Talk)Wade Minter
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 
SCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with ChefSCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with ChefMatt Ray
 
Tips
TipsTips
Tipsmclee
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to KubernetesPaul Czarkowski
 
OpenStack Swift的性能调优
OpenStack Swift的性能调优OpenStack Swift的性能调优
OpenStack Swift的性能调优Hardway Hou
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstackRoberto Polli
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011Carlos Sanchez
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOpsAgile Spain
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012Carlos Sanchez
 
From Dev to DevOps - Apache Barcamp Spain 2011
From Dev to DevOps - Apache Barcamp Spain 2011From Dev to DevOps - Apache Barcamp Spain 2011
From Dev to DevOps - Apache Barcamp Spain 2011Carlos Sanchez
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckrICh morrow
 
PHPCR e API Platform: cosa significa davvero sviluppare un CMF con Symfony
PHPCR e API Platform: cosa significa davvero sviluppare un CMF con SymfonyPHPCR e API Platform: cosa significa davvero sviluppare un CMF con Symfony
PHPCR e API Platform: cosa significa davvero sviluppare un CMF con SymfonyInnoteam Srl
 
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaAOE
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...NETWAYS
 

Similaire à PhpTour Lyon 2014 - Transparent caching & context aware http cache (20)

OpenStack APIs: Present and Future (Beta Talk)
OpenStack APIs: Present and Future (Beta Talk)OpenStack APIs: Present and Future (Beta Talk)
OpenStack APIs: Present and Future (Beta Talk)
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
SCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with ChefSCALE 2011 Deploying OpenStack with Chef
SCALE 2011 Deploying OpenStack with Chef
 
Tips
TipsTips
Tips
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to Kubernetes
 
OpenStack Swift的性能调优
OpenStack Swift的性能调优OpenStack Swift的性能调优
OpenStack Swift的性能调优
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstack
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011
 
TIAD : Automating the modern datacenter
TIAD : Automating the modern datacenterTIAD : Automating the modern datacenter
TIAD : Automating the modern datacenter
 
Pecl Picks
Pecl PicksPecl Picks
Pecl Picks
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
From Dev to DevOps - Apache Barcamp Spain 2011
From Dev to DevOps - Apache Barcamp Spain 2011From Dev to DevOps - Apache Barcamp Spain 2011
From Dev to DevOps - Apache Barcamp Spain 2011
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
PHPCR e API Platform: cosa significa davvero sviluppare un CMF con Symfony
PHPCR e API Platform: cosa significa davvero sviluppare un CMF con SymfonyPHPCR e API Platform: cosa significa davvero sviluppare un CMF con Symfony
PHPCR e API Platform: cosa significa davvero sviluppare un CMF con Symfony
 
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS Lambda
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 

Plus de André Rømcke

SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis ClusterSymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis ClusterAndré Rømcke
 
SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster
SfDay 2019: Head first into Symfony Cache, Redis & Redis ClusterSfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster
SfDay 2019: Head first into Symfony Cache, Redis & Redis ClusterAndré Rømcke
 
Symfony live London 2018 - Take your http caching to the next level with xke...
Symfony live London 2018 -  Take your http caching to the next level with xke...Symfony live London 2018 -  Take your http caching to the next level with xke...
Symfony live London 2018 - Take your http caching to the next level with xke...André Rømcke
 
PHP Benelux 2017 - Caching The Right Way
PHP Benelux 2017 -  Caching The Right WayPHP Benelux 2017 -  Caching The Right Way
PHP Benelux 2017 - Caching The Right WayAndré Rømcke
 
Look Towards 2.0 and Beyond - eZ Conference 2016
Look Towards 2.0 and Beyond -   eZ Conference 2016Look Towards 2.0 and Beyond -   eZ Conference 2016
Look Towards 2.0 and Beyond - eZ Conference 2016André Rømcke
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyAndré Rømcke
 
eZ publish 5[-alpha1] Introduction & Architecture
eZ publish 5[-alpha1] Introduction & ArchitectureeZ publish 5[-alpha1] Introduction & Architecture
eZ publish 5[-alpha1] Introduction & ArchitectureAndré Rømcke
 
eZ Publish 5, Re architecture, pitfalls and opportunities
eZ Publish 5, Re architecture, pitfalls and opportunitieseZ Publish 5, Re architecture, pitfalls and opportunities
eZ Publish 5, Re architecture, pitfalls and opportunitiesAndré Rømcke
 

Plus de André Rømcke (8)

SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis ClusterSymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
 
SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster
SfDay 2019: Head first into Symfony Cache, Redis & Redis ClusterSfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster
SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster
 
Symfony live London 2018 - Take your http caching to the next level with xke...
Symfony live London 2018 -  Take your http caching to the next level with xke...Symfony live London 2018 -  Take your http caching to the next level with xke...
Symfony live London 2018 - Take your http caching to the next level with xke...
 
PHP Benelux 2017 - Caching The Right Way
PHP Benelux 2017 -  Caching The Right WayPHP Benelux 2017 -  Caching The Right Way
PHP Benelux 2017 - Caching The Right Way
 
Look Towards 2.0 and Beyond - eZ Conference 2016
Look Towards 2.0 and Beyond -   eZ Conference 2016Look Towards 2.0 and Beyond -   eZ Conference 2016
Look Towards 2.0 and Beyond - eZ Conference 2016
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
 
eZ publish 5[-alpha1] Introduction & Architecture
eZ publish 5[-alpha1] Introduction & ArchitectureeZ publish 5[-alpha1] Introduction & Architecture
eZ publish 5[-alpha1] Introduction & Architecture
 
eZ Publish 5, Re architecture, pitfalls and opportunities
eZ Publish 5, Re architecture, pitfalls and opportunitieseZ Publish 5, Re architecture, pitfalls and opportunities
eZ Publish 5, Re architecture, pitfalls and opportunities
 

Dernier

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 

Dernier (20)

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 

PhpTour Lyon 2014 - Transparent caching & context aware http cache

  • 1. “Symfony2  &  eZ  Publish  5  jouent  à  Cache  Cache” Transparent  Caching  &  Context  aware  HTTP  Cache PHPTour  Lyon  2014  Lightning  talk,  Presented  by  Bertrand  Dunogier  &  André  Rømcke   Expanded  for  Online  consumpQon
  • 2. About  eZ •eZ  Systems  AS  :    ez.no   •Used  PHP  since  the  start  in  1999   •Offices  in:  Lyon,  Paris,  New  York,  Oslo,  Skien,  Köln,  Katowice,  Tokyo,  +  suppliers   •Partners:  100+  spread  across  Europe,  America  and  Asia   •Customers:  500+  (EMI,  Orange,  Canal+,  Financial  Times,  Madsack,  ..)   ! •eZ  Publish  v5.x  :    hQps://github.com/ezsystems/ezpublish-­‐community   •5.x  is  Dual  Kernel:   •“PlaWorm”:  Symfony2,  Doctrine,  Stash..  +  Future  proof  Public  API’s   •“Legacy”:  Latests  version  of  kernel  that  has  powered  eZ  Publish  since  v3.0  (2001)   •Flexible:  content  model,  workflows,  permission  system,  ..  everything..   •Many  web-­‐features  out  of  the  box  “making  your  life  easier”   •Code  &  Data  BC  kept  since  v3.0,  so@  code  migraeon  from  “legacy”  to  “PlaWorm”   unel  2019  using  last  LTS  release 2With new UI as “eZ Platform”, early alpha summer 2014!
  • 4. Transparent  cache? •Not  visible  to  End-­‐,  Editor-­‐,  Admin-­‐User:  “Content  always*  fresh”   •Not  visible  to  Developer:  By  using  predefined  API  &  extension  points   • Almost,  we’ll  get  back  to  this  one..
 
 
 
 
 
 
 
 
 
 
 *  Recommended  purge  strategy  with  Varnish  will  mark  cache  as  expired  but  keep  serving  the  stale  content   unMl  cache  is  refreshed  from  backend,  this  is  a  must  for  high  traffic  scenarios. 4
  • 5. What  kind  of  cache  are  we  talking  about  here?
  • 6. Example  of  app  with  transparent  cache:  eZ  Publish  PlaBorm 6 “Context  aware”   HTTP  Cache Persistence   (DB  access)
  • 8. Benefit  for  developers                //  Create  a  new  Content  drag  for  the  what  we  want  to  update                  $drag  =  $contentService-­‐>createContentDrag(
                $contentService-­‐>loadContentInfo(15042)
        );
                //  Set  a  new  etle                  $struct  =  $contentService-­‐>newContentUpdateStruct();                  $struct-­‐>setField('etle',  ‘PHP  in  2015:  ZendPHPng  vs  HHVM');
                  //  Update  and  publish  the  Content  drag                  $drag  =  $contentService-­‐>updateContent($drag-­‐>versionInfo,  $struct);                  $contentService-­‐>publishVersion($drag-­‐>versionInfo); 8 =  No  code  dealing  with  cache  (in  your  business  logic)
  • 9. But  lets  focus  on  HTTP  Cache,  what  makes  this  work?
  • 10. Context  Aware  HTTP  Cache  takes  HTTP  Headers  as  context  info 10 X-­‐LocaQon-­‐Id:  42 X-­‐LocaQon-­‐Id:  2
 Vary:  X-­‐User-­‐Hash Unique  idenQfier  for  Purge  needs Vary  Cache  per   User  Rights
  • 11. How  to  use  this  in  controllers?
  • 12. Custom  controller  example:  Menu  Controller      /**            *  Renders  the  top  menu,  with  cache  control            *  @return  SymfonyComponentHQpFoundaeonResponse            */          public  funceon  topMenuAceon()          {                  //  Get  root  locaeon  id  for  current  site                  $rootLocaeonId  =  $this-­‐>getConfigResolver()-­‐>getParameter('content.tree_root.locaeon_id');
                //  Sewng  HTTP  cache  for  the  response  to  be  public  and  with  a  TTL  of  1  day.                  $response  =  new  Response;                  $response-­‐>setPublic();                  $response-­‐>setSharedMaxAge(86400);
                //  Menu  will  expire  when  top  locaeon  cache  is  purged.                  $response-­‐>headers-­‐>set('X-­‐Locaeon-­‐Id',  $rootLocaeonId);
                //  Menu  might  vary  depending  on  user  permissions,  so  make  the  cache  vary  on  the  user  hash.                  $response-­‐>setVary('X-­‐User-­‐Hash'); 12
  • 13. Example:  Behind  the  scenes  when  publishing  content
  • 14. Example:  Behind  the  scenes  when  Publishing  Content •For  affected  Content:   •Clear  Persistence  cache   •Purge  (Stale)  HTTP  caches  using  X-­‐Locaeon-­‐id  (the  “placement(s)”  of  a   Content  object)  across  all  User  variants   •By  configuraeon:   •Opeonal  rules  for  addieonal  HTTP  caches  to  clear  (Content  Relaeons,   Locaeon  Children,  Locaeon  Parent,  ..),  useful  when  inline  rendering  is   used  instead  of  only  ESI 14
  • 15. Fin:  Thats  it! •Recently:   •Collaboraeon  with  JoliCode  and  FOS  community  brought  context  aware   caching  to  FOSHQpCacheBundle   ! •Next  up:   •Plan  to  parecipate  more  acevely  further  on  adding  more  features   •Start  to  use  in  eZ  Publish  PlaWorm   ! •TL;DR;  Use  FOSHQpCacheBundle  or  use  eZ  Publish  PlaWorm  which   does  all  of  this  for  you  ;) 15