SlideShare a Scribd company logo
1 of 53
Download to read offline
Caching on the Edge
Fabien Potencier
Let’s run some benchmarks ;)
cacheable for 10 seconds
Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  elit.	
  In	
  vel	
  nulla	
  arcu,	
  
vitae	
  cursus	
  nunc.	
  Integer	
  semper	
  turpis	
  et	
  enim	
  por6tor	
  iaculis.	
  Nulla	
  
facilisi.	
  Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  elit.	
  Mauris	
  
vehicula	
  ves;bulum	
  dictum.	
  Aenean	
  non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
  
malesuada	
  aliquam.	
  Mauris	
  dignissim,	
  urna	
  quis	
  iaculis	
  tempus,	
  justo	
  libero	
  
por6tor	
  est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
  ante.	
  Curabitur	
  interdum	
  luctus	
  
metus,	
  in	
  pulvinar	
  lectus	
  rutrum	
  sit	
  amet.	
  Duis	
  gravida,	
  metus	
  in	
  dictum	
  
eleifend,	
  dolor	
  risus	
  ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
  sapien	
  in	
  elit.	
  Nulla	
  
rutrum	
  erat	
  id	
  neque	
  suscipit	
  eu	
  ultricies	
  odio	
  sollicitudin.	
  Aliquam	
  a	
  mi	
  vel	
  
eros	
  placerat	
  hendrerit.	
  Phasellus	
  por6tor,	
  augue	
  sit	
  amet	
  vulputate	
  
venena;s,	
  dui	
  leo	
  commodo	
  odio,	
  a	
  euismod	
  turpis	
  ligula	
  in	
  elit.	
  Sed	
  cursus	
  
tortor	
  quis	
  dolor	
  aliquet	
  accumsan.	
  	
  
Curabitur	
  convallis	
  egestas	
  erat,	
  et	
  pharetra	
  neque	
  faucibus	
  vitae.	
  Integer	
  at	
  
urna	
  leo.	
  Suspendisse	
  poten;.	
  Nulla	
  hendrerit	
  nisl	
  sit	
  amet	
  lorem	
  semper	
  
               comes from DB
nec	
  porta	
  mauris	
  volutpat.	
  Curabitur	
  a	
  velit	
  erat,	
  a	
  viverra	
  sem.	
  Duis	
  a	
  eros	
  
nec	
  diam	
  faucibus	
  vehicula	
  a	
  sed	
  orci.	
  Vivamus	
  vehicula	
  dapibus	
  tellus	
  in	
  
                 (simulated)
luctus.	
  Curabitur	
  luctus,	
  lorem	
  ac	
  pre;um	
  pharetra,	
  nisl	
  risus	
  condimentum	
  
mi,	
  sit	
  amet	
  placerat	
  orci	
  ante	
  et	
  velit.	
  Vivamus	
  dapibus	
  nulla	
  tempor	
  metus	
  
tris;que	
  vel	
  gravida	
  purus	
  pre;um.	
  Curabitur	
  suscipit	
  bibendum	
  massa,	
  at	
  
imperdiet	
  purus	
  interdum	
  sit	
  amet.	
  Donec	
  ;ncidunt	
  porta	
  dictum.	
  
requests / second
      600	
  




      500	
  




      400	
  




      300	
                                                    symfony	
  
                                                               Symfony2	
  



      200	
  




      100	
  




          0	
  
                  10	
     30	
     50	
     70	
     90	
  
For 10 concurrent users,
Symfony2 is 5 times faster than symfony
requests / second
      600	
  




      500	
  




      400	
  




      300	
                                                                 symfony	
  
                                                                            Symfony2	
  



      200	
  




      100	
  




          0	
  
                  10	
     30	
     50	
     70	
              90	
  


                                                      number of concurrent users
For 100 concurrent users,
Symfony2 is 11 times faster than symfony
What if I add an HTTP accelerator?
Symfony2 embraces the HTTP specification
HTTP Expiration / HTTP Validation
$response->setSharedMaxAge(...);
$response->setTtl(...);
$response->setMaxAge(...);
$response->setClientTtl(...);
$response->setExpires(...);

$response->setETag(...);
$response->setLastModified(...);
Cache-Control: s-maxage=10
public function showAction()
{
  // ...

    $response = $this->render('...', $vars);

    $response->setSharedMaxAge(10);

    return $response;
}
public function showAction()
{
  // ...

    $response = $this->createResponse();
    $response->setSharedMaxAge(10);

    return $this->render(
      '...', $vars, $response);
}
Symfony 2 comes built-in with an HTTP accelerator
$kernel = new HelloCache(
   new HelloKernel('prod', false)
);

$kernel->handle()->send();
Let’s run some benchmarks… again
cacheable for 10 seconds
                                                                       cacheable for 5 seconds
Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
              Lorem	
  ipsum	
  dolor	
  sit	
  
adipiscing	
  elit.	
  In	
  vel	
  nulla	
  arcu,	
  vitae	
         amet,	
  consectetur	
  
cursus	
  nunc.	
  Integer	
  semper	
  turpis	
  et	
  enim	
        adipiscing	
  elit.	
  In	
  vel	
  nulla	
  
por6tor	
  iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
         arcu,	
  vitae	
  cursus	
  nunc.	
  
dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  elit.	
         Integer	
  semper	
  turpis	
  et	
  
Mauris	
  vehicula	
  ves;bulum	
  dictum.	
                          enim	
  por6tor	
  iaculis.	
  
Aenean	
  non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
           Nulla	
  facilisi.	
  Lorem	
  ipsum	
  
malesuada	
  aliquam.	
  Mauris	
  dignissim,	
  urna	
               dolor	
  sit	
  amet,	
  
quis	
  iaculis	
  tempus,	
  justo	
  libero	
  por6tor	
            consectetur	
  adipiscing	
  elit.	
  
est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
  ante.	
            Mauris	
  vehicula	
  
Curabitur	
  interdum	
  luctus	
  metus,	
  in	
                     ves;bulum	
  dictum.	
  
pulvinar	
  lectus	
  rutrum	
  sit	
  amet.	
  Duis	
                Aenean	
  non	
  velit	
  tortor.	
  
gravida,	
  metus	
  in	
  dictum	
  eleifend,	
  dolor	
             Nullam	
  adipiscing	
  
risus	
  ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
  
          comes from DB                                               malesuada	
  aliquam.	
  
                                                                               comes from DB
sapien	
  in	
  elit.	
  Nulla	
  rutrum	
  erat	
  id	
  neque	
     Mauris	
  dignissim,	
  urna	
  
              (simulated)
suscipit	
  eu	
  ultricies	
  odio	
  sollicitudin.	
  
                                                                                 (simulated)
                                                                      quis	
  iaculis	
  tempus,	
  justo	
  
Aliquam	
  a	
  mi	
  vel	
  eros	
  placerat	
  hendrerit.	
         libero	
  por6tor	
  est,	
  nec	
  
Phasellus	
  por6tor,	
  augue	
  sit	
  amet	
                       eleifend	
  est	
  elit	
  vitae	
  ante.	
  
vulputate	
  venena;s,	
  dui	
  leo	
  commodo	
                     Curabitur	
  interdum	
  luctus	
  
odio,	
  a	
  euismod	
  turpis	
  ligula	
  in	
  elit.	
  	
        metus.	
  
requests / second
       600	
  




       500	
  




       400	
  




       300	
                                                              symfony	
  
                                                                          Symfony2	
  



       200	
  




       100	
  




           0	
  
                   10	
     30	
     50	
     70	
            90	
  


                                                   number of concurrent requests
For 10 concurrent users,
Symfony2 is 8 times faster than symfony
For 100 concurrent users,
Symfony2 is 85 times faster than symfony
cacheable for 10 seconds                                    cacheable for 5 seconds
         Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
           Lorem	
  ipsum	
  dolor	
  sit	
  
layout   adipiscing	
  elit.	
  In	
  vel	
  nulla	
  arcu,	
  vitae	
      amet,	
  consectetur	
  
         cursus	
  nunc.	
  Integer	
  semper	
  turpis	
  et	
  enim	
     adipiscing	
  elit.	
  In	
  vel	
  nulla	
  
         por6tor	
  iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
      arcu,	
  vitae	
  cursus	
  nunc.	
  
         dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  elit.	
      Integer	
  semper	
  turpis	
  et	
  
         Mauris	
  vehicula	
  ves;bulum	
  dictum.	
                       enim	
  por6tor	
  iaculis.	
  
         Aenean	
  non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
        Nulla	
  facilisi.	
  Lorem	
  ipsum	
  
         malesuada	
  aliquam.	
  Mauris	
  dignissim,	
  urna	
            dolor	
  sit	
  amet,	
  
         quis	
  iaculis	
  tempus,	
  justo	
  libero	
  por6tor	
         consectetur	
  adipiscing	
  elit.	
  
         est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
  ante.	
         Mauris	
  vehicula	
  
         Curabitur	
  interdum	
  luctus	
  metus,	
  in	
                  ves;bulum	
  dictum.	
  
         pulvinar	
  lectus	
  rutrum	
  sit	
  amet.	
  Duis	
             Aenean	
  non	
  velit	
  tortor.	
  
         gravida,	
  metus	
  in	
  dictum	
  eleifend,	
  dolor	
          Nullam	
  adipiscing	
  
         risus	
  ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
         malesuada	
  aliquam.	
  
         sapien	
  main Nulla	
  rutrum	
  erat	
  id	
  neque	
  
                     in	
  elit.	
                                          Mauris	
  dignissim,	
  in
                                                                                      component urna	
  
         suscipit	
  eu	
  ultricies	
  odio	
  sollicitudin.	
  
                   action                                                   quis	
  iaculis	
  tempus,	
  justo	
  
                                                                                        the layout
         Aliquam	
  a	
  mi	
  vel	
  eros	
  placerat	
  hendrerit.	
      libero	
  por6tor	
  est,	
  nec	
  
         Phasellus	
  por6tor,	
  augue	
  sit	
  amet	
                    eleifend	
  est	
  elit	
  vitae	
  ante.	
  
         vulputate	
  venena;s,	
  dui	
  leo	
  commodo	
                  Curabitur	
  interdum	
  luctus	
  
         odio,	
  a	
  euismod	
  turpis	
  ligula	
  in	
  elit.	
  	
     metus.	
  


                                 NOT cacheable
<?php $view->extend('...:layout') ?>

<?php $view->slots->start('sidebar') ?>

  <?php echo $view->actions->render('...:list') ?>

<?php $view->slots->stop() ?>

Lorem ipsum...
cacheable for 10 seconds
<?php $view->extend('...:layout') ?>

<?php $view->slots->start('sidebar') ?> for 5 seconds
                                  cacheable
  <?php echo $view->actions->render('...:list') ?>

<?php $view->slots->stop() ?>

Lorem ipsum...
$view->actions->render('...:list', array(
   'standalone' => true,
))
Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
              Lorem	
  ipsum	
  dolor	
  sit	
  
adipiscing	
  elit.	
  In	
  vel	
  nulla	
  arcu,	
  vitae	
         amet,	
  consectetur	
  
cursus	
  nunc.	
  Integer	
  semper	
  turpis	
  et	
  enim	
        adipiscing	
  elit.	
  In	
  vel	
  nulla	
  
por6tor	
  iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
         arcu,	
  vitae	
  cursus	
  nunc.	
  
dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  elit.	
         Integer	
  semper	
  turpis	
  et	
  
Mauris	
  vehicula	
  ves;bulum	
  dictum.	
                          enim	
  por6tor	
  iaculis.	
  
Aenean	
  non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
           Nulla	
  facilisi.	
  Lorem	
  ipsum	
  
malesuada	
  aliquam.	
  Mauris	
  dignissim,	
  urna	
               dolor	
  sit	
  amet,	
  
quis	
  iaculis	
  tempus,	
  justo	
  libero	
  por6tor	
            consectetur	
  adipiscing	
  elit.	
  
est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
  ante.	
            Mauris	
  vehicula	
  
Curabitur	
  interdum	
  luctus	
  metus,	
  in	
                     ves;bulum	
  dictum.	
  
pulvinar	
  lectus	
  rutrum	
  sit	
  amet.	
  Duis	
                Aenean	
  non	
  velit	
  tortor.	
  
gravida,	
  metus	
  in	
  dictum	
  eleifend,	
  dolor	
             Nullam	
  adipiscing	
  
risus	
  ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
            malesuada	
  aliquam.	
  
sapien	
  in	
  elit.	
  Nulla	
  rutrum	
  erat	
  id	
  neque	
     Mauris	
  dignissim,	
  urna	
  
suscipit	
  eu	
  ultricies	
  odio	
  sollicitudin.	
                quis	
  iaculis	
  tempus,	
  justo	
  
Aliquam	
  a	
  mi	
  vel	
  eros	
  placerat	
  hendrerit.	
         libero	
  por6tor	
  est,	
  nec	
  
Phasellus	
  por6tor,	
  augue	
  sit	
  amet	
                       eleifend	
  est	
  elit	
  vitae	
  ante.	
  
vulputate	
  venena;s,	
  dui	
  leo	
  commodo	
                     Curabitur	
  interdum	
  luctus	
  
odio,	
  a	
  euismod	
  turpis	
  ligula	
  in	
  elit.	
  	
        metus.	
  
<esi:include src="..." />
Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
  
adipiscing	
  elit.	
  In	
  vel	
  nulla	
  arcu,	
  vitae	
  
cursus	
  nunc.	
  Integer	
  semper	
  turpis	
  et	
  enim	
  
por6tor	
  iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
  
dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  elit.	
  
Mauris	
  vehicula	
  ves;bulum	
  dictum.	
  
Aenean	
  non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
  
malesuada	
  aliquam.	
  Mauris	
  dignissim,	
  urna	
  
quis	
  iaculis	
  tempus,	
  justo	
  libero	
  por6tor	
  
est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
  ante.	
  
Curabitur	
  interdum	
  luctus	
  metus,	
  in	
  
pulvinar	
  lectus	
  rutrum	
  sit	
  amet.	
  Duis	
  
gravida,	
  metus	
  in	
  dictum	
  eleifend,	
  dolor	
  
risus	
  ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
  
sapien	
  in	
  elit.	
  Nulla	
  rutrum	
  erat	
  id	
  neque	
  
suscipit	
  eu	
  ultricies	
  odio	
  sollicitudin.	
  
Aliquam	
  a	
  mi	
  vel	
  eros	
  placerat	
  hendrerit.	
  
Phasellus	
  por6tor,	
  augue	
  sit	
  amet	
  
vulputate	
  venena;s,	
  dui	
  leo	
  commodo	
  
odio,	
  a	
  euismod	
  turpis	
  ligula	
  in	
  elit.	
  	
  
ESI… or Edge Side Includes
Lorem	
  ipsum	
  
                                                                      dolor	
  sit	
  
                                                                      amet,	
  	
  

         1
                                                                  2




                                                                                                       Symfony2 Application
                                                                                           Lorem	
  
                                                                                           ipsum	
  




                                                  Reverse Proxy
                                                                                           dolor	
  
Client




                                                                  3


             Lorem	
  ipsum	
     Lorem	
  
             dolor	
  sit	
       ipsum	
  
             amet,	
  	
          dolor	
  



                                              4
base layout

       layout

Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
                                                                        Lorem	
  ipsum	
  dolor	
  sit	
  
consectetur	
  adipiscing	
  elit.	
  In	
  vel	
  nulla	
       Lorem	
  ipsum	
  dolor	
  sit	
                amet,	
  consectetur	
  
                                                                                                                      included page
      main template                                              amet,	
  consectetur	
  
arcu,	
  vitae	
  cursus	
  nunc.	
  Integer	
  semper	
             included page                               adipiscing	
  elit.	
  In	
  vel	
  
turpis	
  et	
  enim	
  por6tor	
  iaculis.	
  Nulla	
           adipiscing	
  elit.	
  In	
  vel	
  nulla	
     nulla	
  arcu,	
  vitae	
  cursus	
  
facilisi.	
  Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
           arcu,	
  vitae	
  cursus	
  nunc.	
             nunc.	
  Integer	
  semper	
  
consectetur	
  adipiscing	
  elit.	
  Mauris	
                   Integer	
  semper	
  turpis	
  et	
             turpis	
  et	
  enim	
  por6tor	
  
vehicula	
  ves;bulum	
  dictum.	
  Aenean	
                     enim	
  por6tor	
  iaculis.	
                   iaculis.	
  Nulla	
  facilisi.	
  
non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
                Nulla	
  facilisi.	
  Lorem	
  ipsum	
          Lorem	
  ipsum	
  dolor	
  sit	
  
malesuada	
  aliquam.	
  Mauris	
  dignissim,	
                  dolor	
  sit	
  amet,	
                         amet,	
  consectetur	
  
urna	
  quis	
  iaculis	
  tempus,	
  justo	
  libero	
          consectetur	
  adipiscing	
  elit.	
            adipiscing	
  elit.	
  Mauris	
  
por6tor	
  est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
     Mauris	
  vehicula	
                            vehicula	
  ves;bulum	
  
ante.	
  Curabitur	
  interdum	
  luctus	
  metus,	
             ves;bulum	
  dictum.	
                          dictum.	
  Aenean	
  non	
  
in	
  pulvinar	
  lectus	
  rutrum	
  sit	
  amet.	
  Duis	
     Aenean	
  non	
  velit	
  tortor.	
             velit	
  tortor.	
  Nullam	
  
gravida,	
  metus	
  in	
  dictum	
  eleifend,	
                 Nullam	
  adipiscing	
                          adipiscing	
  malesuada	
  
dolor	
  risus	
  ;ncidunt	
  ligula,	
  non	
                   malesuada	
  aliquam.	
                         aliquam.	
  	
  
volutpat	
  nulla	
  sapien	
  in	
  elit.	
  Nulla	
            Mauris	
  dignissim,	
  urna	
  
rutrum	
  erat	
  id	
  neque	
  suscipit	
  eu	
                quis	
  iaculis	
  tempus,	
  justo	
            Lorem	
  ipsum	
  dolor	
  sit	
  
ultricies	
  odio	
  sollicitudin.	
  Aliquam	
  a	
  mi	
       libero	
  por6tor	
  est,	
  nec	
               amet,	
  consectetur	
  
                                                                                                                      included page
vel	
  eros	
  placerat	
  hendrerit.	
  Phasellus	
             eleifend	
  est	
  elit	
  vitae	
  ante.	
      adipiscing	
  elit.	
  In	
  vel	
  
por6tor,	
  augue	
  sit	
  amet	
  vulputate	
                  Curabitur	
  interdum	
  luctus	
                nulla	
  arcu,	
  vitae	
  
venena;s,	
  dui	
  leo	
  commodo	
  odio,	
  a	
               metus.	
                                         cursus	
  nunc.	
  	
  
euismod	
  turpis	
  ligula	
  in	
  elit.	
  	
  
Goal
     Be as dynamic as needed
Hit the application as less as possible
P2Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
                       Lorem	
  ipsum	
  dolor	
  sit	
  
                                                                                                                     consectetur	
  adipiscing	
  elit.	
  In	
  vel	
  nulla	
      amet,	
  consectetur	
  
                                                                                                                     arcu,	
  vitae	
  cursus	
  nunc.	
  Integer	
                  adipiscing	
  elit.	
  In	
  vel	
  
                                                                                                                     semper	
  turpis	
  et	
  enim	
  por6tor	
                     nulla	
  arcu,	
  vitae	
  cursus	
  
                                                                                                                     iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
              nunc.	
  Integer	
  semper	
  
                                                                                                                     dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
            turpis	
  et	
  enim	
  
                                                                                                                     elit.	
  Mauris	
  vehicula	
  ves;bulum	
                      por6tor	
  iaculis.	
  Nulla	
  
                                                                                                                     dictum.	
  Aenean	
  non	
  velit	
  tortor.	
                  facilisi.	
  Lorem	
  ipsum	
  
                                                                                                                     Nullam	
  adipiscing	
  malesuada	
  aliquam.	
                 dolor	
  sit	
  amet,	
  

P1
Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  elit.	
  In	
  vel	
  
                                                                                                                     Mauris	
  dignissim,	
  urna	
  quis	
  iaculis	
  
                                                                                                                     tempus,	
  justo	
  libero	
  por6tor	
  est,	
  nec	
  
                                                                                                                     eleifend	
  est	
  elit	
  vitae	
  ante.	
  Curabitur	
  
                                                                                                                                                                                     consectetur	
  adipiscing	
  
                                                                                                                                                                                     elit.	
  Mauris	
  vehicula	
  
                                                                                                                                                                                     ves;bulum	
  dictum.	
  
nulla	
  arcu,	
  vitae	
  cursus	
  nunc.	
  Integer	
  semper	
  turpis	
  et	
  enim	
  
                                                                                                                     interdum	
  luctus	
  metus,	
  in	
  pulvinar	
                Aenean	
  non	
  velit	
  
por6tor	
  iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
                               lectus	
  rutrum	
  sit	
  amet.	
  Duis	
  gravida,	
  
consectetur	
  adipiscing	
  elit.	
  Mauris	
  vehicula	
  ves;bulum	
  dictum.	
                                                                                                   tortor.	
  Nullam	
  
                                                                                                                     metus	
  in	
  dictum	
  eleifend,	
  dolor	
  risus	
          adipiscing	
  malesuada	
  
Aenean	
  non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
  malesuada	
  aliquam.	
  
Mauris	
  dignissim,	
  urna	
  quis	
  iaculis	
  tempus,	
  justo	
  libero	
  por6tor	
                                   10S
                                                                                                                     ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
  
                                                                                                                     sapien	
  in	
  elit.	
  
                                                                                                                                                                                              5S
                                                                                                                                                                                     aliquam	
  
est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
  ante.	
  Curabitur	
  interdum	
  luctus	
  
metus,	
  in	
  pulvinar	
  lectus	
  rutrum	
  sit	
  amet.	
  Duis	
  gravida,	
  metus	
  in	
  
dictum	
  eleifend,	
  dolor	
  risus	
  ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
  
sapien	
  in	
  elit.	
  Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
  
elit.	
  In	
  vel	
  nulla	
  arcu,	
  vitae	
  cursus	
  nunc.	
  Integer	
  semper	
  turpis	
  et	
  
                                                                                                                                                                                                  Expiration
enim	
  por6tor	
  iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
  
consectetur	
  adipiscing	
  elit.	
  Mauris	
  vehicula	
  ves;bulum	
  dictum.	
  
Aenean	
  non	
  velit	
  tortor.	
  Nullam	
  adipiscing	
  malesuada	
  aliquam.	
  
Mauris	
  dignissim,	
  urna	
  quis	
  iaculis	
  tempus,	
  justo	
  libero	
  por6tor	
  
         10S
est,	
  nec	
  eleifend	
  est	
  elit	
  vitae	
  ante.	
  Curabitur	
  interdum	
  luctus	
  
                                                                                                                   P3 Lorem	
  ipsum	
  dolor	
  sit	
  amet,	
                       Lorem	
  ipsum	
  dolor	
  sit	
  
metus,	
  in	
  pulvinar	
  lectus	
  rutrum	
  sit	
  amet	
                                                         consectetur	
  adipiscing	
  elit.	
  In	
  vel	
  nulla	
      amet,	
  consectetur	
  
                                                                                                                      arcu,	
  vitae	
  cursus	
  nunc.	
  Integer	
                  adipiscing	
  elit.	
  In	
  vel	
  
                                                                                                                      semper	
  turpis	
  et	
  enim	
  por6tor	
  

   Expiration
                                                                                                                                                                                      nulla	
  arcu,	
  vitae	
  cursus	
  
                                                                                                                      iaculis.	
  Nulla	
  facilisi.	
  Lorem	
  ipsum	
              nunc.	
  Integer	
  semper	
  
                                                                                                                      dolor	
  sit	
  amet,	
  consectetur	
  adipiscing	
            turpis	
  et	
  enim	
  


                                                                                                            Expiration
                                                                                                                      elit.	
  Mauris	
  vehicula	
  ves;bulum	
                      por6tor	
  iaculis.	
  Nulla	
  
                                                                                                                      dictum.	
  Aenean	
  non	
  velit	
  tortor.	
                  facilisi.	
  Lorem	
  ipsum	
  
                                                                                                                      Nullam	
  adipiscing	
  malesuada	
  aliquam.	
                 dolor	
  sit	
  amet,	
  
                                                                                                                      Mauris	
  dignissim,	
  urna	
  quis	
  iaculis	
               consectetur	
  adipiscing	
  

                                                                                                                 &    tempus,	
  justo	
  libero	
  por6tor	
  est,	
  nec	
  
                                                                                                                      eleifend	
  est	
  elit	
  vitae	
  ante.	
  Curabitur	
  
                                                                                                                      interdum	
  luctus	
  metus,	
  in	
  pulvinar	
  
                                                                                                                                                                                      elit.	
  Mauris	
  vehicula	
  
                                                                                                                                                                                      ves;bulum	
  dictum.	
  
                                                                                                                                                                                      Aenean	
  non	
  velit	
  

                                                                                                             Validation 10S
                                                                                                                      lectus	
  rutrum	
  sit	
  amet.	
  Duis	
  gravida,	
          tortor.	
  Nullam	
  
                                                                                                                      metus	
  in	
  dictum	
  eleifend,	
  dolor	
  risus	
          adipiscing	
  malesuada	
  
                                                                                                                                                  ETag
                                                                                                                      ;ncidunt	
  ligula,	
  non	
  volutpat	
  nulla	
  
                                                                                                                      sapien	
  in	
  elit.	
  
                                                                                                                                                                                          5S
                                                                                                                                                                                      aliquam	
            ETag
PHP SF 300


                                             Web Server




           P1 100 P2 100 P3 100               symfony
                                                app
Requests




                                  Response
PHP SF 300


                                            Web Server

                                        symfony cache


           P1 10 P2 100 P3 100               symfony
                                               app
Requests
           P1 90




                                 Response
PHP SF 201


                                           Web Server

                                       symfony cache


           P1 1 P2 100 P3 100               symfony
                                              app
Requests

           P1 99 management!
            No HTTP




                                Response
PHP SF2 300


                                             Web Server




           P1 100 P2 100 P3 100              Symfony2
                                               app
Requests




                                  Response
PHP SF2 140
           PHP LIGHT 180

                                                Web Server

                                         Symfony2 HTTP proxy


           P1 10 P2 10 + 20 P3 100              Symfony2
                                                  app
Requests
           P1 90 P2 90




                                     Response
PHP SF2 140
           PHP LIGHT 0
                                           Reverse proxy

                                                Web Server




           P1 10 P2 10 + 20 P3 100              Symfony2
                                                  app
Requests
           P1 90 P2 90




                                     Response
The power is even bigger than what you think…
$view->actions->render('...:list', array(
   'standalone' => true,
   'ignore_errors' => true,
   'alt' => 'BlogBundle:Post:error'
))


<esi:include
  src="..." alt="..." on-error="ignore" />
$view->actions->render(
  'http://www.google.com/',
  array(
    'standalone' => true,
    'ignore_errors' => true,
    'alt' => 'BlogBundle:Post:error'
  )
)
stale-while-revalidate - rfc5861
stale-if-error - rfc5861
There are only two hard things in Computer Science:
cache invalidation and naming things. -- Phil Karlton




                              http://martinfowler.com/bliki/TwoHardThings.html
Code is still experimental and buggy
http://datatracker.ietf.org/wg/httpbis/
Questions?
Sensio S.A.
   92-98, boulevard Victor Hugo
       92 115 Clichy Cedex
             FRANCE
      Tél. : +33 1 40 99 80 80

              Contact
          Fabien Potencier
   fabien.potencier at sensio.com


  http://www.sensiolabs.com/
http://www.symfony-project.org/
 http://fabien.potencier.org/
http://tomayko.com/writings/things-caches-do

http://www.slideshare.net/rtomayko/https-bestkept-secret-caching

http://content.newrelic.com/railslab/videos/10-ScalingRails-Client-
   Side-Caching.mp4

http://content.newrelic.com/railslab/videos/11-ScalingRails-Advanced-
   HTTP-Caching.mp4
// do only what is needed to compute
// the ETag and Last-Modified header values

$response = $this->createResponse();
$response->setEtag('post_'.$post->getId());
$response->setLastModified($post->getPublishedAt());

if ($response->isNotModified($this->getRequest())) {
  return $response;
}

// do some heavy stuff here

return $this->render('...:post', $vars, $response);
// from http://varnish-cache.org/wiki/FAQ/Compression
// normalize Accept-Encoding HTTP header
protected function lookup(Request $request)
{
  if ($ae = $request->headers->get('Accept-Encoding')) {
    if (preg_match('/.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$/',
$request->getRequestUri())) {
      // no point in compressing these
      $request->headers->delete('Accept-Encoding');
    } elseif (false !== strpos($ae, 'gzip')) {
      $request->headers->set('Accept-Encoding', 'gzip');
    } elseif (false !== strpos($ae, 'deflate')) {
      $request->headers->set('Accept-Encoding', 'deflate');
    } else {
      // unkown algorithm
      $request->headers->delete('Accept-Encoding');
    }
  }

    return parent::lookup($request);
}
PHP SF2 60
           PHP LIGHT 180
                                              Web Server

                                       Symfony2 HTTP proxy

                                     Symfony2Validation accel.


           P2 10 + 20 P3 10 + 20                Symfony2
                                                  app
Requests   P3 90
           P2 90




                                   Response
PHP SF2 60
           PHP LIGHT 90
                                         Reverse proxy

                                              Web Server

                                     Symfony2Validation accel.


           P2 10 + 20 P3 10 + 20              Symfony2
                                                app
Requests
           P3 90

           P2 90




                                   Response

More Related Content

Viewers also liked

Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Fabien Potencier
 
You Shall Not Pass - Security in Symfony
You Shall Not Pass - Security in SymfonyYou Shall Not Pass - Security in Symfony
You Shall Not Pass - Security in SymfonyThe Software House
 
Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3Fabien Potencier
 
Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Fabien Potencier
 

Viewers also liked (7)

Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2Unit and Functional Testing with Symfony2
Unit and Functional Testing with Symfony2
 
Symfony Components
Symfony ComponentsSymfony Components
Symfony Components
 
Testing and symfony2
Testing and symfony2Testing and symfony2
Testing and symfony2
 
You Shall Not Pass - Security in Symfony
You Shall Not Pass - Security in SymfonyYou Shall Not Pass - Security in Symfony
You Shall Not Pass - Security in Symfony
 
Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3Design patterns revisited with PHP 5.3
Design patterns revisited with PHP 5.3
 
Varnish
VarnishVarnish
Varnish
 
Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4Dependency injection in PHP 5.3/5.4
Dependency injection in PHP 5.3/5.4
 

Similar to Caching on the Edge with Symfony2

170424 isaca lux slides
170424 isaca lux slides170424 isaca lux slides
170424 isaca lux slidesHenri Kuiper
 
4.3 mixed scheme dark version
4.3 mixed scheme   dark version4.3 mixed scheme   dark version
4.3 mixed scheme dark versionhamza bekkali
 
16.9 mixed scheme dark version
16.9 mixed scheme   dark version16.9 mixed scheme   dark version
16.9 mixed scheme dark versionhamza bekkali
 
I just hacked your app! - Marcos Placona - Codemotion Rome 2017
I just hacked your app! - Marcos Placona - Codemotion Rome 2017I just hacked your app! - Marcos Placona - Codemotion Rome 2017
I just hacked your app! - Marcos Placona - Codemotion Rome 2017Codemotion
 
Addons And Fennec UI
Addons And Fennec UIAddons And Fennec UI
Addons And Fennec UIMadhava Enros
 
PRESENTATION FOR SMARTPHONE SCREENS
PRESENTATION FOR SMARTPHONE SCREENSPRESENTATION FOR SMARTPHONE SCREENS
PRESENTATION FOR SMARTPHONE SCREENSINKPPT
 
Marketing By Design
Marketing By DesignMarketing By Design
Marketing By DesignBrandon Eley
 
KTV Brochure
KTV BrochureKTV Brochure
KTV BrochureKenya TV
 
20 Things You Can Do to Make Your Library's Website Better Right Now
20 Things You Can Do to Make Your Library's Website Better Right Now20 Things You Can Do to Make Your Library's Website Better Right Now
20 Things You Can Do to Make Your Library's Website Better Right NowLaura Solomon
 
PowerPoint 2013 Animation and Transitions
PowerPoint 2013 Animation and Transitions PowerPoint 2013 Animation and Transitions
PowerPoint 2013 Animation and Transitions Yeasir Arafat
 
CanChild_Print_PowerPoint_Branding
CanChild_Print_PowerPoint_BrandingCanChild_Print_PowerPoint_Branding
CanChild_Print_PowerPoint_BrandingAbdulRahman Khodr
 

Similar to Caching on the Edge with Symfony2 (20)

170424 isaca lux slides
170424 isaca lux slides170424 isaca lux slides
170424 isaca lux slides
 
4.3 mixed scheme
4.3 mixed scheme4.3 mixed scheme
4.3 mixed scheme
 
4.3 mixed scheme dark version
4.3 mixed scheme   dark version4.3 mixed scheme   dark version
4.3 mixed scheme dark version
 
4.3 blue scheme
4.3 blue scheme4.3 blue scheme
4.3 blue scheme
 
4.3 red scheme
4.3 red scheme4.3 red scheme
4.3 red scheme
 
16.9 red scheme
16.9 red scheme16.9 red scheme
16.9 red scheme
 
16.9 mixed scheme dark version
16.9 mixed scheme   dark version16.9 mixed scheme   dark version
16.9 mixed scheme dark version
 
16.9 blue scheme
16.9 blue scheme16.9 blue scheme
16.9 blue scheme
 
16.9 mixed scheme
16.9 mixed scheme16.9 mixed scheme
16.9 mixed scheme
 
16.9 blue scheme
16.9 blue scheme16.9 blue scheme
16.9 blue scheme
 
I just hacked your app! - Marcos Placona - Codemotion Rome 2017
I just hacked your app! - Marcos Placona - Codemotion Rome 2017I just hacked your app! - Marcos Placona - Codemotion Rome 2017
I just hacked your app! - Marcos Placona - Codemotion Rome 2017
 
Addons And Fennec UI
Addons And Fennec UIAddons And Fennec UI
Addons And Fennec UI
 
PRESENTATION FOR SMARTPHONE SCREENS
PRESENTATION FOR SMARTPHONE SCREENSPRESENTATION FOR SMARTPHONE SCREENS
PRESENTATION FOR SMARTPHONE SCREENS
 
Marketing By Design
Marketing By DesignMarketing By Design
Marketing By Design
 
KTV Brochure
KTV BrochureKTV Brochure
KTV Brochure
 
20 Things You Can Do to Make Your Library's Website Better Right Now
20 Things You Can Do to Make Your Library's Website Better Right Now20 Things You Can Do to Make Your Library's Website Better Right Now
20 Things You Can Do to Make Your Library's Website Better Right Now
 
20 Things You Can Do to Make Your Library's Website Better Right Now
20 Things You Can Do to Make Your Library's Website Better Right Now20 Things You Can Do to Make Your Library's Website Better Right Now
20 Things You Can Do to Make Your Library's Website Better Right Now
 
PowerPoint 2013 Animation and Transitions
PowerPoint 2013 Animation and Transitions PowerPoint 2013 Animation and Transitions
PowerPoint 2013 Animation and Transitions
 
Pitch deck premium
Pitch deck premiumPitch deck premium
Pitch deck premium
 
CanChild_Print_PowerPoint_Branding
CanChild_Print_PowerPoint_BrandingCanChild_Print_PowerPoint_Branding
CanChild_Print_PowerPoint_Branding
 

More from Fabien Potencier

The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010Fabien Potencier
 
Dependency injection - phpday 2010
Dependency injection - phpday 2010Dependency injection - phpday 2010
Dependency injection - phpday 2010Fabien Potencier
 
Dependency Injection IPC 201
Dependency Injection IPC 201Dependency Injection IPC 201
Dependency Injection IPC 201Fabien Potencier
 
Dependency Injection with PHP 5.3
Dependency Injection with PHP 5.3Dependency Injection with PHP 5.3
Dependency Injection with PHP 5.3Fabien Potencier
 
Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Fabien Potencier
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Fabien Potencier
 
Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009Fabien Potencier
 
Symfony And Zend Framework Together 2009
Symfony And Zend Framework Together 2009Symfony And Zend Framework Together 2009
Symfony And Zend Framework Together 2009Fabien Potencier
 
Twig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHPTwig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHPFabien Potencier
 
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)Fabien Potencier
 
The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)Fabien Potencier
 

More from Fabien Potencier (19)

Caching on the Edge
Caching on the EdgeCaching on the Edge
Caching on the Edge
 
The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010
 
Dependency injection - phpday 2010
Dependency injection - phpday 2010Dependency injection - phpday 2010
Dependency injection - phpday 2010
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010Symfony2 - OSIDays 2010
Symfony2 - OSIDays 2010
 
Dependency Injection IPC 201
Dependency Injection IPC 201Dependency Injection IPC 201
Dependency Injection IPC 201
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Symfony2 revealed
Symfony2 revealedSymfony2 revealed
Symfony2 revealed
 
Dependency Injection with PHP 5.3
Dependency Injection with PHP 5.3Dependency Injection with PHP 5.3
Dependency Injection with PHP 5.3
 
Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3Dependency Injection with PHP and PHP 5.3
Dependency Injection with PHP and PHP 5.3
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3
 
Playing With PHP 5.3
Playing With PHP 5.3Playing With PHP 5.3
Playing With PHP 5.3
 
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
 
Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009
 
Symfony And Zend Framework Together 2009
Symfony And Zend Framework Together 2009Symfony And Zend Framework Together 2009
Symfony And Zend Framework Together 2009
 
Twig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHPTwig, the flexible, fast, and secure template language for PHP
Twig, the flexible, fast, and secure template language for PHP
 
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)
 
The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)The symfony platform: Create your very own framework (PHP Quebec 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)
 

Recently uploaded

ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreelreely ones
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsUXDXConf
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 

Recently uploaded (20)

ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 

Caching on the Edge with Symfony2

  • 1. Caching on the Edge Fabien Potencier
  • 2. Let’s run some benchmarks ;)
  • 3. cacheable for 10 seconds Lorem  ipsum  dolor  sit  amet,  consectetur  adipiscing  elit.  In  vel  nulla  arcu,   vitae  cursus  nunc.  Integer  semper  turpis  et  enim  por6tor  iaculis.  Nulla   facilisi.  Lorem  ipsum  dolor  sit  amet,  consectetur  adipiscing  elit.  Mauris   vehicula  ves;bulum  dictum.  Aenean  non  velit  tortor.  Nullam  adipiscing   malesuada  aliquam.  Mauris  dignissim,  urna  quis  iaculis  tempus,  justo  libero   por6tor  est,  nec  eleifend  est  elit  vitae  ante.  Curabitur  interdum  luctus   metus,  in  pulvinar  lectus  rutrum  sit  amet.  Duis  gravida,  metus  in  dictum   eleifend,  dolor  risus  ;ncidunt  ligula,  non  volutpat  nulla  sapien  in  elit.  Nulla   rutrum  erat  id  neque  suscipit  eu  ultricies  odio  sollicitudin.  Aliquam  a  mi  vel   eros  placerat  hendrerit.  Phasellus  por6tor,  augue  sit  amet  vulputate   venena;s,  dui  leo  commodo  odio,  a  euismod  turpis  ligula  in  elit.  Sed  cursus   tortor  quis  dolor  aliquet  accumsan.     Curabitur  convallis  egestas  erat,  et  pharetra  neque  faucibus  vitae.  Integer  at   urna  leo.  Suspendisse  poten;.  Nulla  hendrerit  nisl  sit  amet  lorem  semper   comes from DB nec  porta  mauris  volutpat.  Curabitur  a  velit  erat,  a  viverra  sem.  Duis  a  eros   nec  diam  faucibus  vehicula  a  sed  orci.  Vivamus  vehicula  dapibus  tellus  in   (simulated) luctus.  Curabitur  luctus,  lorem  ac  pre;um  pharetra,  nisl  risus  condimentum   mi,  sit  amet  placerat  orci  ante  et  velit.  Vivamus  dapibus  nulla  tempor  metus   tris;que  vel  gravida  purus  pre;um.  Curabitur  suscipit  bibendum  massa,  at   imperdiet  purus  interdum  sit  amet.  Donec  ;ncidunt  porta  dictum.  
  • 4. requests / second 600   500   400   300   symfony   Symfony2   200   100   0   10   30   50   70   90  
  • 5. For 10 concurrent users, Symfony2 is 5 times faster than symfony
  • 6. requests / second 600   500   400   300   symfony   Symfony2   200   100   0   10   30   50   70   90   number of concurrent users
  • 7. For 100 concurrent users, Symfony2 is 11 times faster than symfony
  • 8. What if I add an HTTP accelerator?
  • 9. Symfony2 embraces the HTTP specification
  • 10. HTTP Expiration / HTTP Validation
  • 13. public function showAction() { // ... $response = $this->render('...', $vars); $response->setSharedMaxAge(10); return $response; }
  • 14. public function showAction() { // ... $response = $this->createResponse(); $response->setSharedMaxAge(10); return $this->render( '...', $vars, $response); }
  • 15. Symfony 2 comes built-in with an HTTP accelerator
  • 16. $kernel = new HelloCache( new HelloKernel('prod', false) ); $kernel->handle()->send();
  • 17. Let’s run some benchmarks… again
  • 18. cacheable for 10 seconds cacheable for 5 seconds Lorem  ipsum  dolor  sit  amet,  consectetur   Lorem  ipsum  dolor  sit   adipiscing  elit.  In  vel  nulla  arcu,  vitae   amet,  consectetur   cursus  nunc.  Integer  semper  turpis  et  enim   adipiscing  elit.  In  vel  nulla   por6tor  iaculis.  Nulla  facilisi.  Lorem  ipsum   arcu,  vitae  cursus  nunc.   dolor  sit  amet,  consectetur  adipiscing  elit.   Integer  semper  turpis  et   Mauris  vehicula  ves;bulum  dictum.   enim  por6tor  iaculis.   Aenean  non  velit  tortor.  Nullam  adipiscing   Nulla  facilisi.  Lorem  ipsum   malesuada  aliquam.  Mauris  dignissim,  urna   dolor  sit  amet,   quis  iaculis  tempus,  justo  libero  por6tor   consectetur  adipiscing  elit.   est,  nec  eleifend  est  elit  vitae  ante.   Mauris  vehicula   Curabitur  interdum  luctus  metus,  in   ves;bulum  dictum.   pulvinar  lectus  rutrum  sit  amet.  Duis   Aenean  non  velit  tortor.   gravida,  metus  in  dictum  eleifend,  dolor   Nullam  adipiscing   risus  ;ncidunt  ligula,  non  volutpat  nulla   comes from DB malesuada  aliquam.   comes from DB sapien  in  elit.  Nulla  rutrum  erat  id  neque   Mauris  dignissim,  urna   (simulated) suscipit  eu  ultricies  odio  sollicitudin.   (simulated) quis  iaculis  tempus,  justo   Aliquam  a  mi  vel  eros  placerat  hendrerit.   libero  por6tor  est,  nec   Phasellus  por6tor,  augue  sit  amet   eleifend  est  elit  vitae  ante.   vulputate  venena;s,  dui  leo  commodo   Curabitur  interdum  luctus   odio,  a  euismod  turpis  ligula  in  elit.     metus.  
  • 19. requests / second 600   500   400   300   symfony   Symfony2   200   100   0   10   30   50   70   90   number of concurrent requests
  • 20. For 10 concurrent users, Symfony2 is 8 times faster than symfony
  • 21. For 100 concurrent users, Symfony2 is 85 times faster than symfony
  • 22. cacheable for 10 seconds cacheable for 5 seconds Lorem  ipsum  dolor  sit  amet,  consectetur   Lorem  ipsum  dolor  sit   layout adipiscing  elit.  In  vel  nulla  arcu,  vitae   amet,  consectetur   cursus  nunc.  Integer  semper  turpis  et  enim   adipiscing  elit.  In  vel  nulla   por6tor  iaculis.  Nulla  facilisi.  Lorem  ipsum   arcu,  vitae  cursus  nunc.   dolor  sit  amet,  consectetur  adipiscing  elit.   Integer  semper  turpis  et   Mauris  vehicula  ves;bulum  dictum.   enim  por6tor  iaculis.   Aenean  non  velit  tortor.  Nullam  adipiscing   Nulla  facilisi.  Lorem  ipsum   malesuada  aliquam.  Mauris  dignissim,  urna   dolor  sit  amet,   quis  iaculis  tempus,  justo  libero  por6tor   consectetur  adipiscing  elit.   est,  nec  eleifend  est  elit  vitae  ante.   Mauris  vehicula   Curabitur  interdum  luctus  metus,  in   ves;bulum  dictum.   pulvinar  lectus  rutrum  sit  amet.  Duis   Aenean  non  velit  tortor.   gravida,  metus  in  dictum  eleifend,  dolor   Nullam  adipiscing   risus  ;ncidunt  ligula,  non  volutpat  nulla   malesuada  aliquam.   sapien  main Nulla  rutrum  erat  id  neque   in  elit.   Mauris  dignissim,  in component urna   suscipit  eu  ultricies  odio  sollicitudin.   action quis  iaculis  tempus,  justo   the layout Aliquam  a  mi  vel  eros  placerat  hendrerit.   libero  por6tor  est,  nec   Phasellus  por6tor,  augue  sit  amet   eleifend  est  elit  vitae  ante.   vulputate  venena;s,  dui  leo  commodo   Curabitur  interdum  luctus   odio,  a  euismod  turpis  ligula  in  elit.     metus.   NOT cacheable
  • 23. <?php $view->extend('...:layout') ?> <?php $view->slots->start('sidebar') ?> <?php echo $view->actions->render('...:list') ?> <?php $view->slots->stop() ?> Lorem ipsum...
  • 24. cacheable for 10 seconds <?php $view->extend('...:layout') ?> <?php $view->slots->start('sidebar') ?> for 5 seconds cacheable <?php echo $view->actions->render('...:list') ?> <?php $view->slots->stop() ?> Lorem ipsum...
  • 25. $view->actions->render('...:list', array( 'standalone' => true, ))
  • 26. Lorem  ipsum  dolor  sit  amet,  consectetur   Lorem  ipsum  dolor  sit   adipiscing  elit.  In  vel  nulla  arcu,  vitae   amet,  consectetur   cursus  nunc.  Integer  semper  turpis  et  enim   adipiscing  elit.  In  vel  nulla   por6tor  iaculis.  Nulla  facilisi.  Lorem  ipsum   arcu,  vitae  cursus  nunc.   dolor  sit  amet,  consectetur  adipiscing  elit.   Integer  semper  turpis  et   Mauris  vehicula  ves;bulum  dictum.   enim  por6tor  iaculis.   Aenean  non  velit  tortor.  Nullam  adipiscing   Nulla  facilisi.  Lorem  ipsum   malesuada  aliquam.  Mauris  dignissim,  urna   dolor  sit  amet,   quis  iaculis  tempus,  justo  libero  por6tor   consectetur  adipiscing  elit.   est,  nec  eleifend  est  elit  vitae  ante.   Mauris  vehicula   Curabitur  interdum  luctus  metus,  in   ves;bulum  dictum.   pulvinar  lectus  rutrum  sit  amet.  Duis   Aenean  non  velit  tortor.   gravida,  metus  in  dictum  eleifend,  dolor   Nullam  adipiscing   risus  ;ncidunt  ligula,  non  volutpat  nulla   malesuada  aliquam.   sapien  in  elit.  Nulla  rutrum  erat  id  neque   Mauris  dignissim,  urna   suscipit  eu  ultricies  odio  sollicitudin.   quis  iaculis  tempus,  justo   Aliquam  a  mi  vel  eros  placerat  hendrerit.   libero  por6tor  est,  nec   Phasellus  por6tor,  augue  sit  amet   eleifend  est  elit  vitae  ante.   vulputate  venena;s,  dui  leo  commodo   Curabitur  interdum  luctus   odio,  a  euismod  turpis  ligula  in  elit.     metus.  
  • 27. <esi:include src="..." /> Lorem  ipsum  dolor  sit  amet,  consectetur   adipiscing  elit.  In  vel  nulla  arcu,  vitae   cursus  nunc.  Integer  semper  turpis  et  enim   por6tor  iaculis.  Nulla  facilisi.  Lorem  ipsum   dolor  sit  amet,  consectetur  adipiscing  elit.   Mauris  vehicula  ves;bulum  dictum.   Aenean  non  velit  tortor.  Nullam  adipiscing   malesuada  aliquam.  Mauris  dignissim,  urna   quis  iaculis  tempus,  justo  libero  por6tor   est,  nec  eleifend  est  elit  vitae  ante.   Curabitur  interdum  luctus  metus,  in   pulvinar  lectus  rutrum  sit  amet.  Duis   gravida,  metus  in  dictum  eleifend,  dolor   risus  ;ncidunt  ligula,  non  volutpat  nulla   sapien  in  elit.  Nulla  rutrum  erat  id  neque   suscipit  eu  ultricies  odio  sollicitudin.   Aliquam  a  mi  vel  eros  placerat  hendrerit.   Phasellus  por6tor,  augue  sit  amet   vulputate  venena;s,  dui  leo  commodo   odio,  a  euismod  turpis  ligula  in  elit.    
  • 28. ESI… or Edge Side Includes
  • 29. Lorem  ipsum   dolor  sit   amet,     1 2 Symfony2 Application Lorem   ipsum   Reverse Proxy dolor   Client 3 Lorem  ipsum   Lorem   dolor  sit   ipsum   amet,     dolor   4
  • 30. base layout layout Lorem  ipsum  dolor  sit  amet,   Lorem  ipsum  dolor  sit   consectetur  adipiscing  elit.  In  vel  nulla   Lorem  ipsum  dolor  sit   amet,  consectetur   included page main template amet,  consectetur   arcu,  vitae  cursus  nunc.  Integer  semper   included page adipiscing  elit.  In  vel   turpis  et  enim  por6tor  iaculis.  Nulla   adipiscing  elit.  In  vel  nulla   nulla  arcu,  vitae  cursus   facilisi.  Lorem  ipsum  dolor  sit  amet,   arcu,  vitae  cursus  nunc.   nunc.  Integer  semper   consectetur  adipiscing  elit.  Mauris   Integer  semper  turpis  et   turpis  et  enim  por6tor   vehicula  ves;bulum  dictum.  Aenean   enim  por6tor  iaculis.   iaculis.  Nulla  facilisi.   non  velit  tortor.  Nullam  adipiscing   Nulla  facilisi.  Lorem  ipsum   Lorem  ipsum  dolor  sit   malesuada  aliquam.  Mauris  dignissim,   dolor  sit  amet,   amet,  consectetur   urna  quis  iaculis  tempus,  justo  libero   consectetur  adipiscing  elit.   adipiscing  elit.  Mauris   por6tor  est,  nec  eleifend  est  elit  vitae   Mauris  vehicula   vehicula  ves;bulum   ante.  Curabitur  interdum  luctus  metus,   ves;bulum  dictum.   dictum.  Aenean  non   in  pulvinar  lectus  rutrum  sit  amet.  Duis   Aenean  non  velit  tortor.   velit  tortor.  Nullam   gravida,  metus  in  dictum  eleifend,   Nullam  adipiscing   adipiscing  malesuada   dolor  risus  ;ncidunt  ligula,  non   malesuada  aliquam.   aliquam.     volutpat  nulla  sapien  in  elit.  Nulla   Mauris  dignissim,  urna   rutrum  erat  id  neque  suscipit  eu   quis  iaculis  tempus,  justo   Lorem  ipsum  dolor  sit   ultricies  odio  sollicitudin.  Aliquam  a  mi   libero  por6tor  est,  nec   amet,  consectetur   included page vel  eros  placerat  hendrerit.  Phasellus   eleifend  est  elit  vitae  ante.   adipiscing  elit.  In  vel   por6tor,  augue  sit  amet  vulputate   Curabitur  interdum  luctus   nulla  arcu,  vitae   venena;s,  dui  leo  commodo  odio,  a   metus.   cursus  nunc.     euismod  turpis  ligula  in  elit.    
  • 31. Goal Be as dynamic as needed Hit the application as less as possible
  • 32. P2Lorem  ipsum  dolor  sit  amet,   Lorem  ipsum  dolor  sit   consectetur  adipiscing  elit.  In  vel  nulla   amet,  consectetur   arcu,  vitae  cursus  nunc.  Integer   adipiscing  elit.  In  vel   semper  turpis  et  enim  por6tor   nulla  arcu,  vitae  cursus   iaculis.  Nulla  facilisi.  Lorem  ipsum   nunc.  Integer  semper   dolor  sit  amet,  consectetur  adipiscing   turpis  et  enim   elit.  Mauris  vehicula  ves;bulum   por6tor  iaculis.  Nulla   dictum.  Aenean  non  velit  tortor.   facilisi.  Lorem  ipsum   Nullam  adipiscing  malesuada  aliquam.   dolor  sit  amet,   P1 Lorem  ipsum  dolor  sit  amet,  consectetur  adipiscing  elit.  In  vel   Mauris  dignissim,  urna  quis  iaculis   tempus,  justo  libero  por6tor  est,  nec   eleifend  est  elit  vitae  ante.  Curabitur   consectetur  adipiscing   elit.  Mauris  vehicula   ves;bulum  dictum.   nulla  arcu,  vitae  cursus  nunc.  Integer  semper  turpis  et  enim   interdum  luctus  metus,  in  pulvinar   Aenean  non  velit   por6tor  iaculis.  Nulla  facilisi.  Lorem  ipsum  dolor  sit  amet,   lectus  rutrum  sit  amet.  Duis  gravida,   consectetur  adipiscing  elit.  Mauris  vehicula  ves;bulum  dictum.   tortor.  Nullam   metus  in  dictum  eleifend,  dolor  risus   adipiscing  malesuada   Aenean  non  velit  tortor.  Nullam  adipiscing  malesuada  aliquam.   Mauris  dignissim,  urna  quis  iaculis  tempus,  justo  libero  por6tor   10S ;ncidunt  ligula,  non  volutpat  nulla   sapien  in  elit.   5S aliquam   est,  nec  eleifend  est  elit  vitae  ante.  Curabitur  interdum  luctus   metus,  in  pulvinar  lectus  rutrum  sit  amet.  Duis  gravida,  metus  in   dictum  eleifend,  dolor  risus  ;ncidunt  ligula,  non  volutpat  nulla   sapien  in  elit.  Lorem  ipsum  dolor  sit  amet,  consectetur  adipiscing   elit.  In  vel  nulla  arcu,  vitae  cursus  nunc.  Integer  semper  turpis  et   Expiration enim  por6tor  iaculis.  Nulla  facilisi.  Lorem  ipsum  dolor  sit  amet,   consectetur  adipiscing  elit.  Mauris  vehicula  ves;bulum  dictum.   Aenean  non  velit  tortor.  Nullam  adipiscing  malesuada  aliquam.   Mauris  dignissim,  urna  quis  iaculis  tempus,  justo  libero  por6tor   10S est,  nec  eleifend  est  elit  vitae  ante.  Curabitur  interdum  luctus   P3 Lorem  ipsum  dolor  sit  amet,   Lorem  ipsum  dolor  sit   metus,  in  pulvinar  lectus  rutrum  sit  amet   consectetur  adipiscing  elit.  In  vel  nulla   amet,  consectetur   arcu,  vitae  cursus  nunc.  Integer   adipiscing  elit.  In  vel   semper  turpis  et  enim  por6tor   Expiration nulla  arcu,  vitae  cursus   iaculis.  Nulla  facilisi.  Lorem  ipsum   nunc.  Integer  semper   dolor  sit  amet,  consectetur  adipiscing   turpis  et  enim   Expiration elit.  Mauris  vehicula  ves;bulum   por6tor  iaculis.  Nulla   dictum.  Aenean  non  velit  tortor.   facilisi.  Lorem  ipsum   Nullam  adipiscing  malesuada  aliquam.   dolor  sit  amet,   Mauris  dignissim,  urna  quis  iaculis   consectetur  adipiscing   & tempus,  justo  libero  por6tor  est,  nec   eleifend  est  elit  vitae  ante.  Curabitur   interdum  luctus  metus,  in  pulvinar   elit.  Mauris  vehicula   ves;bulum  dictum.   Aenean  non  velit   Validation 10S lectus  rutrum  sit  amet.  Duis  gravida,   tortor.  Nullam   metus  in  dictum  eleifend,  dolor  risus   adipiscing  malesuada   ETag ;ncidunt  ligula,  non  volutpat  nulla   sapien  in  elit.   5S aliquam   ETag
  • 33. PHP SF 300 Web Server P1 100 P2 100 P3 100 symfony app Requests Response
  • 34. PHP SF 300 Web Server symfony cache P1 10 P2 100 P3 100 symfony app Requests P1 90 Response
  • 35. PHP SF 201 Web Server symfony cache P1 1 P2 100 P3 100 symfony app Requests P1 99 management! No HTTP Response
  • 36. PHP SF2 300 Web Server P1 100 P2 100 P3 100 Symfony2 app Requests Response
  • 37. PHP SF2 140 PHP LIGHT 180 Web Server Symfony2 HTTP proxy P1 10 P2 10 + 20 P3 100 Symfony2 app Requests P1 90 P2 90 Response
  • 38. PHP SF2 140 PHP LIGHT 0 Reverse proxy Web Server P1 10 P2 10 + 20 P3 100 Symfony2 app Requests P1 90 P2 90 Response
  • 39. The power is even bigger than what you think…
  • 40. $view->actions->render('...:list', array( 'standalone' => true, 'ignore_errors' => true, 'alt' => 'BlogBundle:Post:error' )) <esi:include src="..." alt="..." on-error="ignore" />
  • 41. $view->actions->render( 'http://www.google.com/', array( 'standalone' => true, 'ignore_errors' => true, 'alt' => 'BlogBundle:Post:error' ) )
  • 44. There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton http://martinfowler.com/bliki/TwoHardThings.html
  • 45. Code is still experimental and buggy
  • 48. Sensio S.A. 92-98, boulevard Victor Hugo 92 115 Clichy Cedex FRANCE Tél. : +33 1 40 99 80 80 Contact Fabien Potencier fabien.potencier at sensio.com http://www.sensiolabs.com/ http://www.symfony-project.org/ http://fabien.potencier.org/
  • 50. // do only what is needed to compute // the ETag and Last-Modified header values $response = $this->createResponse(); $response->setEtag('post_'.$post->getId()); $response->setLastModified($post->getPublishedAt()); if ($response->isNotModified($this->getRequest())) { return $response; } // do some heavy stuff here return $this->render('...:post', $vars, $response);
  • 51. // from http://varnish-cache.org/wiki/FAQ/Compression // normalize Accept-Encoding HTTP header protected function lookup(Request $request) { if ($ae = $request->headers->get('Accept-Encoding')) { if (preg_match('/.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$/', $request->getRequestUri())) { // no point in compressing these $request->headers->delete('Accept-Encoding'); } elseif (false !== strpos($ae, 'gzip')) { $request->headers->set('Accept-Encoding', 'gzip'); } elseif (false !== strpos($ae, 'deflate')) { $request->headers->set('Accept-Encoding', 'deflate'); } else { // unkown algorithm $request->headers->delete('Accept-Encoding'); } } return parent::lookup($request); }
  • 52. PHP SF2 60 PHP LIGHT 180 Web Server Symfony2 HTTP proxy Symfony2Validation accel. P2 10 + 20 P3 10 + 20 Symfony2 app Requests P3 90 P2 90 Response
  • 53. PHP SF2 60 PHP LIGHT 90 Reverse proxy Web Server Symfony2Validation accel. P2 10 + 20 P3 10 + 20 Symfony2 app Requests P3 90 P2 90 Response