SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
“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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a Symfony2 & eZ Publish 5 Transparent Caching

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
 

Semelhante a Symfony2 & eZ Publish 5 Transparent Caching (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
 

Mais 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
 

Mais 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
 

Último

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 

Último (20)

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 

Symfony2 & eZ Publish 5 Transparent Caching

  • 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