Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Magento 2 Caching Strategies

Magento 2 Caching Strategies

Meet Magento Poland, Warsaw, November 24th to November 25th 2014.

Marko Martinović

November 24, 2014
Tweet

More Decks by Marko Martinović

Other Decks in Programming

Transcript

  1. Meet Magento Poland 2014 Frontend Pools Out the box: •

    default - General type instances • page_cache - PageCache type instance
  2. Meet Magento Poland 2014 Cache Types Good old • Configuration

    • Layouts • Blocks HTML output • Collections data • EAV types and attributes • Translations Brand New • View files fallback • View files pre- processing • Integrations Configuration • Integrations API Configuration • Web Services Configuration • PageCache
  3. Meet Magento Poland 2014 EAV Types and Attributes Implemented to

    cache eav_entity_type table collection. Still here, still unused, still no one knows why.
  4. Meet Magento Poland 2014 EAV Types and Attributes "One developer

    is working on it for a month, other comments it out for testing, third one is then afraid to enable it back" -Ivan Weiler @Inchoo
  5. Meet Magento Poland 2014 View Files Fallback Requested asset is

    being searched for using fallback rules applied to fallback context
  6. Meet Magento Poland 2014 View Files Pre-processing Pre-processing of Magento-flavoured

    CSS tricks like @magento_import, @import, scope notation file references and Less
  7. Meet Magento Poland 2014 PageCache Out the box: • PHP/AJAX

    based (Built-in) • Reverse proxy/ESI/AJAX based (Varnish)
  8. Meet Magento Poland 2014 PageCache Caching controlled by ‘Cache-Control’: public,

    max-age=XY, s-maxage=XY vs. private, max-age=YZ vs. no-store, no-cache, must-revalidate, max- age=0
  9. Meet Magento Poland 2014 Hole Punching Setting _isScopePrivate to some

    block results with its content not being cached
  10. Meet Magento Poland 2014 Hole Punching Setting ttl to some

    block results with its content being served through ESI and cached by Varnish
  11. Meet Magento Poland 2014 Built-in Dynamic blocks not cached and

    served exclusively through AJAX: <!-- BLOCK header --><li class="greet welcome">Default welcome msg!</li><!-- /BLOCK header -->
  12. Meet Magento Poland 2014 Built-in Pros • Works out the

    box with no special setup Cons • Leaves a lot to be desired performance- wise
  13. Meet Magento Poland 2014 Varnish With ttl set, dynamic blocks

    cached and served through ESI: <esi:include src="..." />
  14. Meet Magento Poland 2014 Varnish Pros • The best performing

    caching solution, if properly configured Cons • The worst performing caching solution, if configured improperly • Considerable setup and maintenance overhead • Requires SSL termination proxy to support HTTPS