Magento caching

13

Click here to load reader

description

A laydown of all Magento caching technologies (like Redis, memcached, APC), PHP accelerators (including Zend Optimizer+) and Full Page Cache options (Varnish, LestiFPC, Zoom).

Transcript of Magento caching

Page 1: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Magento Caching

Page 2: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

About PHP accelerators

PHP is an interpreted language. The PHP interpreter converts PHP to bytecode. A PHP engine can cache interpreted bytecode into memory (or on the filesystem) by using a PHP accelerator (aka opcode cacher).

Page 3: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

PHP accelerators - listing

Zend Optimizer+Built into PHP 5.5; Optional in PHP 5.4

APCStandard opcode cacher under PHP 5.3 and PHP 5.4

Obsolete: Xcache

eAccelerator

Page 4: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

PHP accelerators - tips

Using Zend Optimizer+PHP 5.5: Enabled by default

PHP 5.4: Perhaps faster than APC > benchmark for yourself

Using APCMake sure APC cache is large enough

Make sure TTL is set and not 0

Set apc.stat = 0 if PHP-files don't change anymore

Page 5: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Magento cache / session handlers (1/2)

File (folder /var/cache)Tip: Store in tmpfs / RAM-disk

Database

APC (Advanced PHP Cache)or APCu (APC userland) under PHP 5.5)

Page 6: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Magento cache / session handlers (2/2)

memcachedDistributed caching system

Run through UNIX socket and not TCP/IP socket

Redis (recommended)Dstributed caching system

Cm_RedisSession extension / Cm_Cache_Backend_Redis

Run through UNIX socket and not TCP/IP socket

Page 7: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Zend TwoLevel Cache

Fast cache backendOptions: APC, memcached, file

Slow cache backendOptions: Files, database, memcached, apc

Ment for management of tags, when fast cache does not

In practiceWhen memcached is used (fast cache), /var/cache is still used (slow cache)

When Redis is used (fast cache), /var/cache stays empty (no slow cache)

Page 8: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Magento caching - tips

Use Redis instead of memcacheBypass Two Level Cache issue (and keep /var/cache empty)

Optimize “files” backend (/var/cache)When small enough, use RAM disk or tmpfs

When larger, use Cm_Cache_Backend_File for more subfolders

When even larger, switch to other caching backend (preferred: Redis)

Larger cacheBeware of a cache being too large (>10Gb). Caching might become pointless.

Page 9: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Magento FPC (Full Page Cache)

Magento Enterprise Edition (Enterprise_PageCache)

Lesti::FPCFree and very flexible

Make sure to configure Layered Navigation properly (especially sliders)

Zoom Full-Page CacheFree and a bit faster than Lesti::FPC

No updates since Magento CE 1.8

A JAX calls for lazy loading

Page 10: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Issues with FPC

Cold cache is slowPrewarm the cache by using site crawlers

Wrong content is displayedHole punching not configured properly

Make sure to check for proper caching of A JAX calls

Session data shared between customersOnly cache non-session specific data

Optionally use customer specific cache (Lesti: “lazy blocks”)

Page 11: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Reverse proxy

NginxAlso native Nginx caching (fastcgi cache)

No hole punching, no cache purging

SSL support

VarnishMagento extension Turpentine

Hole punching support via VCL (Varnish Control Language)

Cache purging via varnishadm (shell)

No SSL support

Page 12: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Yireo server configuration

Nginx / PHP-FPMversion 1.6: SPDY

FastCGI page caching

PHP-FPM through socket, not TCP/IP

PHP 5.4Zend OPC, not APC

Magento + Redis cache

MySQL InnoDB tuning

Page 13: Magento caching

Presentation “Magento Caching” - http://slideshare.net/yireoJisse Reitsma ([email protected]) - Twitter @yireo

Yireo Stuff

DisableLogDisable all Magento logging

ProfilerLogGather profiling statistics over time (plus nice graphs in Magento backend)

Magento Performance InsightsPending: Web-based in summer 2014