SlideShare a Scribd company logo
HEAD FIRST INTO SYMFONY

CACHE, REDIS & REDIS CACHE
André Rømcke (@andrerom)

VP Technical Services & Support @eZSystems
Oct. 18th 2019 - Verona - sfday Italy 2019
https://joind.in/talk/c5187
So what is this talk about?
1. Bit of background on where eZ fits in this
2. Symfony Cache, Cache & Cache tagging
3. Memcached vs Redis
4. Redis & Redis Cluster
5. New Adapters in Symfony 4.3
6. In Practice with symfony/demo & redis-cli
7. BONUS: Edge cases, edge case & more edge
cases
Who?
๏André Rømcke | @andrerom
๏Economics, Consulting, Engineering, Lead, VP Engineering, now Services & Support
๏Contributed to Symfony, FOS, Composer, PHP-FIG, Docker, attempts for PHP…
๏Works for …
๏eZ Systems AS | ez.no
๏Global 75+ people across 7+ countries, with partners & community in many many more
๏Maker of …
๏eZ Platform | ezplatform.com
๏Open Source CMS, a feature rich, flexible Full & Headless, on Symfony since 2012
๏Also exists in commercial flavors: eZ Platform Enterprise & eZ Commerce
๏Uses …
Symfony Cache in eZ Platform
๏Moved over from Stash in 2017
๏Heavily relies on Cache tagging feature
๏Since then contributed improvements on performance issues with Redis/Redis Cluster/…
๏Since spring ships with own optimized TagAware adapters for Redis and FileSystem
➡Contributed these to Symfony 4.3 & Currently improving them for 4.4
Lets get started:
Symfony Cache
ez.no
Symfony Cache Component
๏PSR-6 compliant Cache component
๏Aims to be fast: Among others supports multi get calls to Redis and Memcached
๏Is progressively being used in several places in Symfony Framework, e.g.:
๏PropertyInfo
๏Serializer
๏Validator
๏(…)
๏.. maybe HTTP Cache at some point
ez.no
Symfony Cache Adapters
๏Adapters:
๏APCu (per proces cache)
๏Array (in memory per request, mainly for testing)
๏Chain (chain several adapters after each-other)
๏Doctrine
๏FileSystem (Also PHPFile & PHPArray for immutable opcache cache)
๏Proxy (To reuse other PSR-6 implementations)
๏Redis
๏Memcached
๏And “TagAware”..
ez.no
Hold on, what’s this with Tags?
๏Data/Entities often has secondary indexes
๏Eg. In a CMS it’s things like:
๏content type id
๏section id
๏location id, location path ids, …
๏Sometime operations in your application affect those => affecting bulk of entities
๏So to cache entities, or the result of them (e.g. view):
๏.. you might want a secondary index in the cache to avoid having to iterate database
๏E.g. key: ez-content-66 tags: content-66, type-2, location-44 (…)
ez.no
TagAware: Secondary index for invalidation
/**
* Interface for invalidating cached items using tags.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
interface TagAwareAdapterInterface extends AdapterInterface
{
/**
* Invalidates cached items using tags.
*
* @param string[] $tags An array of tags to invalidate
*
* @return bool True on success
*
* @throws InvalidArgumentException When $tags is not valid
*/
public function invalidateTags(array $tags);
}
ez.no
TagAwareAdapter
๏Wraps your normal adapter, stores item Tags in separate key
๏Does a separate lookup for expiry timestamp for tags => “2-RTT”
Distributed cache backends:

Memcached vs Redis
ez.no
Memcached vs Redis: Overview
๏Vivamus commodo ipsum in hendrerit iaculis.
๏Donec congue erat nibh, ac luctus erat accumsan tempor.
๏Mauris bibendum ac eros eu tempor. Duis libero libero, luctus quis posuere quis, porta vel
turpis.
๏Sed augue dolor, laoreet eget turpis eget, laoreet vehicula neque. Donec sit amet dolor vel
lorem ultrices facilisis ac sit amet velit.
๏Aenean nisi nisi, aliquet in pulvinar mollis, vulputate vitae nulla. Donec non ligula ac diam
volutpat dapibus.
๏Aliquam eleifend turpis id ligula accumsan luctus. Donec sem justo, scelerisque eget
condimentum ut, semper eget nulla.
๏Vivamus ultricies massa lectus, id varius orci sodales quis.
Memcached Redis
Multi operations (get, set, ..) V V
Datatypes String
String, List, Set, Hash, Sorted Set, …
Streams
Control over eviction X V
Persistance X V
Pipeline / Lua X V

Not on Redis Cluster
Multiserver V V

Mainly Redis Cluster OR Redis Sentinel
Multithreaded V X

But multi process with Redis Cluster *
* Redis 6 is adding partly threading with background thread handling slow operations
ez.no
Memcached vs Redis: “Greatly Simplified”
Massive concurrent multi threaded, simple Key-Value store, that
can take advantage of lots of CPU cores, and scales up across
many servers
VS
Datastore for different advance data types to do sophisticated
operations on, which is single threaded, but can be scaled up
with Redis Cluster with some limitations to capabilities.
Topics around:

Redis & Redis Cluster
Datatypes
๏ Strings
๏ Lists
๏ Sets
๏ SortedSets
๏ Hashes
๏ Bitmaps
๏ HyperLogLogs
๏ Streams (As of Redis 5.0)
Commands
๏There are 227 commands and counting
๏There are generic key, cluster, connection, Pub/Sub, Scripting, Transaction commands
๏And Datatypes allows for specific operations, aka commands as well
๏For String it goes beyond flavors of GET / SET, there is e.g. APPEND, BITPOS, DECR, …
๏E.G. for "SET”:
๏SADD, SREM, SPOP
๏SCARD - Returns the set cardinality (number of elements) of the set stored at key
๏SDIFF, SINTER, SUNION, SMOVE
๏SMEMBERS, SSCAN
Eviction
maxmemory-policy:
๏noeviction
๏volatile-random
๏volatile-ttl
๏volatile-lru
๏volatile-lfu (As of Redis 4.0)
๏allkeys-random
๏allkeys-lru
๏allkeys-lfu (As of Redis 4.0)
Redis Cluster: processe
๏Allows you to scale up Redis by running several instances
๏Multi process on same server and/or across servers
๏Coordinates cache across “cache slots", deals with replication, …
๏Unlike Memcached, several operations has limitations on Cluster
Redis Cluster: limitations
๏Does not support “pipline”: capability to perform several operations in one call
๏PHPRedis mainly supports multi operations on MGET and MSET with cluster
๏Examples of affected operations:
๏RENAME won’t work if the new key ends up in another “Cache Slot”
๏EVAL (Lua Script) likewise can only be given keys that maps to same node
ERR	CROSSSLOT	Keys	in	request	don't	hash	to	the	same	slot
New in Symfony 4.3:

FilesystemTagAwareAdapter &
RedisTagAwareAdapter
ez.no
Tags storage
๏Moves tags to be a “relation” to cache key, instead of expiry time
๏Avoids the lookup on getItem(s), instead does it on invalidation
๏FilesystemTagAwareAdapter:
๏4.3: Symlinks for tag “relation”, 4.4: uses a file to list “relations”
๏RedisTagAwareAdapter:
๏Uses “Set” for tag “relation”
๏Forces a default expiry on cache which does not have expiry
ez.no
Why the efforts on 1-RTT lookups?
๏AWS ElasticCache Redis instances has latency of:
๏On larger EC2 instances: 0.2-0.5ms
๏On micro/small instances: Apparently more
๏When hitting backend time it takes to just wait for Redis:
๏Simple page with 20 items shown:
๏~40 lookups x latency = 5-20 ms
๏News site large landing page with 1000 items shown:
๏~2000 lookups x latency = 0.4 - 1 seconds
ez.no
In Symfony Cache:
๏Pipeline used instead of MGET => affecting Redis Cluster
๏Cache versioning lookups on Redis cluster
๏TagAwareAdapter micro ttl cache for tag lookups

Lookup optimizations done over the last year
ez.no
On Application side (eZ Platform):
๏Changs take better advantage of Multi Get
๏Introduce optimized RedisTagAwareAdapter
๏Introduced Application specific in-memory cache

Lookup optimizations done over the last year
ez.no
End result example:
๏Had 17.000 lookups in Symfony Cache on our Admin dashboard
๏Due to Symfony Cache logic this was ~40-60k lookups on Redis Cluster
๏30 seconds in worst case, just waiting for Redis Cluster
๏After all fixes it went down to 63 lookups in Symfony Cache
Lookup optimizations done over the last year
Let’s change symfon/demo to:
Cache index posts
Edit something in admin
Look to cache commands to clear
Add invalidation in Admin
Let’s also connect to redis using redis-cli
Play around and emulate SymfonyCache
Edge cases, edge cases & Edge cases:

Some things to be aware of
ez.no
Some edge cases
๏Race conditions
๏When caching data: Transactions
๏Async / Stale cache
๏RedisTagAwareAdapter: Sets never expire so use memory
The End, Questions?
Talk + Slides: https://joind.in/talk/c5187
Other talks: http://www.slideshare.net/andreromcke
Twitter: @andrerom



eZ Platform: https://ezplatform.com/
Redis: https://redis.io/
Memcached: https://memcached.org

More Related Content

What's hot

JBoss Fuse Workshop 101 part 6
JBoss Fuse Workshop 101 part 6JBoss Fuse Workshop 101 part 6
JBoss Fuse Workshop 101 part 6
Christina Lin
 
CoreOS: Control Your Fleet
CoreOS: Control Your FleetCoreOS: Control Your Fleet
CoreOS: Control Your Fleet
Matthew Jones
 
Terraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group OsloTerraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group Oslo
Anton Babenko
 
Serializing Ruby Objects in Redis
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in Redis
Brian Kaney
 
Terraform Modules and Continuous Deployment
Terraform Modules and Continuous DeploymentTerraform Modules and Continuous Deployment
Terraform Modules and Continuous Deployment
Zane Williamson
 
Elasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep diveElasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep dive
Sematext Group, Inc.
 
Ansible at work
Ansible at workAnsible at work
Ansible at work
Bas Meijer
 
Redis and Ohm
Redis and OhmRedis and Ohm
Redis and Ohm
awksedgreep
 
Fun with Ruby and Redis
Fun with Ruby and RedisFun with Ruby and Redis
Fun with Ruby and Redis
javier ramirez
 
Terraform Abstractions for Safety and Power
Terraform Abstractions for Safety and PowerTerraform Abstractions for Safety and Power
Terraform Abstractions for Safety and Power
Calvin French-Owen
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
Mitchell Pronschinske
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices
Nebulaworks
 
Programming Hive Reading #4
Programming Hive Reading #4Programming Hive Reading #4
Programming Hive Reading #4moai kids
 
Redis, Resque & Friends
Redis, Resque & FriendsRedis, Resque & Friends
Redis, Resque & Friends
Christopher Spring
 
api analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugapi analytics redis bigquery. Lrug
api analytics redis bigquery. Lrug
javier ramirez
 
Terraform - Taming Modern Clouds
Terraform  - Taming Modern CloudsTerraform  - Taming Modern Clouds
Terraform - Taming Modern Clouds
Nic Jackson
 
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientBuilding Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Mike Friedman
 
Infrastructure as Code & Terraform 101
Infrastructure as Code & Terraform 101Infrastructure as Code & Terraform 101
Infrastructure as Code & Terraform 101
Kristoffer Ahl
 
AWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp VaultAWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp Vault
Grzegorz Adamowicz
 

What's hot (20)

JBoss Fuse Workshop 101 part 6
JBoss Fuse Workshop 101 part 6JBoss Fuse Workshop 101 part 6
JBoss Fuse Workshop 101 part 6
 
Redis 101
Redis 101Redis 101
Redis 101
 
CoreOS: Control Your Fleet
CoreOS: Control Your FleetCoreOS: Control Your Fleet
CoreOS: Control Your Fleet
 
Terraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group OsloTerraform Q&A - HashiCorp User Group Oslo
Terraform Q&A - HashiCorp User Group Oslo
 
Serializing Ruby Objects in Redis
Serializing Ruby Objects in RedisSerializing Ruby Objects in Redis
Serializing Ruby Objects in Redis
 
Terraform Modules and Continuous Deployment
Terraform Modules and Continuous DeploymentTerraform Modules and Continuous Deployment
Terraform Modules and Continuous Deployment
 
Elasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep diveElasticsearch for Logs & Metrics - a deep dive
Elasticsearch for Logs & Metrics - a deep dive
 
Ansible at work
Ansible at workAnsible at work
Ansible at work
 
Redis and Ohm
Redis and OhmRedis and Ohm
Redis and Ohm
 
Fun with Ruby and Redis
Fun with Ruby and RedisFun with Ruby and Redis
Fun with Ruby and Redis
 
Terraform Abstractions for Safety and Power
Terraform Abstractions for Safety and PowerTerraform Abstractions for Safety and Power
Terraform Abstractions for Safety and Power
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices
 
Programming Hive Reading #4
Programming Hive Reading #4Programming Hive Reading #4
Programming Hive Reading #4
 
Redis, Resque & Friends
Redis, Resque & FriendsRedis, Resque & Friends
Redis, Resque & Friends
 
api analytics redis bigquery. Lrug
api analytics redis bigquery. Lrugapi analytics redis bigquery. Lrug
api analytics redis bigquery. Lrug
 
Terraform - Taming Modern Clouds
Terraform  - Taming Modern CloudsTerraform  - Taming Modern Clouds
Terraform - Taming Modern Clouds
 
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientBuilding Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::Client
 
Infrastructure as Code & Terraform 101
Infrastructure as Code & Terraform 101Infrastructure as Code & Terraform 101
Infrastructure as Code & Terraform 101
 
AWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp VaultAWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp Vault
 

Similar to SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster

How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)
Kaliop-slide
 
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Maarten Balliauw
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
javier ramirez
 
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach ShoolmanRedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
Redis Labs
 
Engineering an Encrypted Storage Engine
Engineering an Encrypted Storage EngineEngineering an Encrypted Storage Engine
Engineering an Encrypted Storage Engine
MongoDB
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
Wim Godden
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive
Amazon Web Services
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scaling
smattoon
 
Scaling Massive Elasticsearch Clusters
Scaling Massive Elasticsearch ClustersScaling Massive Elasticsearch Clusters
Scaling Massive Elasticsearch ClustersSematext Group, Inc.
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsMarcelo Pinheiro
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisation
grooverdan
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sun
smattoon
 
Unleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCacheUnleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCache
Amazon Web Services
 
Unleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCache Unleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCache
Amazon Web Services
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App development
Luca Garulli
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love Systemd
Richard Lister
 
How to deploy & optimize eZ Publish
How to deploy & optimize eZ PublishHow to deploy & optimize eZ Publish
How to deploy & optimize eZ Publish
Kaliop-slide
 

Similar to SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster (20)

How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)
 
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
 
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach ShoolmanRedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
RedisConf17 - Doing More With Redis - Ofer Bengal and Yiftach Shoolman
 
Engineering an Encrypted Storage Engine
Engineering an Encrypted Storage EngineEngineering an Encrypted Storage Engine
Engineering an Encrypted Storage Engine
 
Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive(DAT407) Amazon ElastiCache: Deep Dive
(DAT407) Amazon ElastiCache: Deep Dive
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scaling
 
Scaling Massive Elasticsearch Clusters
Scaling Massive Elasticsearch ClustersScaling Massive Elasticsearch Clusters
Scaling Massive Elasticsearch Clusters
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability Systems
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisation
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sun
 
Unleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCacheUnleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCache
 
Unleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCache Unleash the Power of Redis with Amazon ElastiCache
Unleash the Power of Redis with Amazon ElastiCache
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App development
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love Systemd
 
How to deploy & optimize eZ Publish
How to deploy & optimize eZ PublishHow to deploy & optimize eZ Publish
How to deploy & optimize eZ Publish
 

More from André 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 Way
André 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 2016
André 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 Symfony
André Rømcke
 
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
André Rømcke
 
PhpTour Lyon 2014 - Transparent caching & context aware http cache
PhpTour Lyon 2014 - Transparent caching & context aware http cachePhpTour Lyon 2014 - Transparent caching & context aware http cache
PhpTour Lyon 2014 - Transparent caching & context aware http cache
André Rømcke
 
eZ publish 5[-alpha1] Introduction & Architecture
eZ publish 5[-alpha1] Introduction & ArchitectureeZ publish 5[-alpha1] Introduction & Architecture
eZ publish 5[-alpha1] Introduction & Architecture
André 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
 

More from André Rømcke (8)

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
 
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
 
PhpTour Lyon 2014 - Transparent caching & context aware http cache
PhpTour Lyon 2014 - Transparent caching & context aware http cachePhpTour Lyon 2014 - Transparent caching & context aware http cache
PhpTour Lyon 2014 - Transparent caching & context aware http cache
 
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
 

Recently uploaded

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
itech2017
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
Nettur Technical Training Foundation
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 

Recently uploaded (20)

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 

SfDay 2019: Head first into Symfony Cache, Redis & Redis Cluster

  • 1. HEAD FIRST INTO SYMFONY
 CACHE, REDIS & REDIS CACHE André Rømcke (@andrerom)
 VP Technical Services & Support @eZSystems Oct. 18th 2019 - Verona - sfday Italy 2019 https://joind.in/talk/c5187
  • 2. So what is this talk about? 1. Bit of background on where eZ fits in this 2. Symfony Cache, Cache & Cache tagging 3. Memcached vs Redis 4. Redis & Redis Cluster 5. New Adapters in Symfony 4.3 6. In Practice with symfony/demo & redis-cli 7. BONUS: Edge cases, edge case & more edge cases
  • 3. Who? ๏André Rømcke | @andrerom ๏Economics, Consulting, Engineering, Lead, VP Engineering, now Services & Support ๏Contributed to Symfony, FOS, Composer, PHP-FIG, Docker, attempts for PHP… ๏Works for … ๏eZ Systems AS | ez.no ๏Global 75+ people across 7+ countries, with partners & community in many many more ๏Maker of … ๏eZ Platform | ezplatform.com ๏Open Source CMS, a feature rich, flexible Full & Headless, on Symfony since 2012 ๏Also exists in commercial flavors: eZ Platform Enterprise & eZ Commerce ๏Uses …
  • 4. Symfony Cache in eZ Platform ๏Moved over from Stash in 2017 ๏Heavily relies on Cache tagging feature ๏Since then contributed improvements on performance issues with Redis/Redis Cluster/… ๏Since spring ships with own optimized TagAware adapters for Redis and FileSystem ➡Contributed these to Symfony 4.3 & Currently improving them for 4.4
  • 6. ez.no Symfony Cache Component ๏PSR-6 compliant Cache component ๏Aims to be fast: Among others supports multi get calls to Redis and Memcached ๏Is progressively being used in several places in Symfony Framework, e.g.: ๏PropertyInfo ๏Serializer ๏Validator ๏(…) ๏.. maybe HTTP Cache at some point
  • 7. ez.no Symfony Cache Adapters ๏Adapters: ๏APCu (per proces cache) ๏Array (in memory per request, mainly for testing) ๏Chain (chain several adapters after each-other) ๏Doctrine ๏FileSystem (Also PHPFile & PHPArray for immutable opcache cache) ๏Proxy (To reuse other PSR-6 implementations) ๏Redis ๏Memcached ๏And “TagAware”..
  • 8. ez.no Hold on, what’s this with Tags? ๏Data/Entities often has secondary indexes ๏Eg. In a CMS it’s things like: ๏content type id ๏section id ๏location id, location path ids, … ๏Sometime operations in your application affect those => affecting bulk of entities ๏So to cache entities, or the result of them (e.g. view): ๏.. you might want a secondary index in the cache to avoid having to iterate database ๏E.g. key: ez-content-66 tags: content-66, type-2, location-44 (…)
  • 9. ez.no TagAware: Secondary index for invalidation /** * Interface for invalidating cached items using tags. * * @author Nicolas Grekas <p@tchwork.com> */ interface TagAwareAdapterInterface extends AdapterInterface { /** * Invalidates cached items using tags. * * @param string[] $tags An array of tags to invalidate * * @return bool True on success * * @throws InvalidArgumentException When $tags is not valid */ public function invalidateTags(array $tags); }
  • 10. ez.no TagAwareAdapter ๏Wraps your normal adapter, stores item Tags in separate key ๏Does a separate lookup for expiry timestamp for tags => “2-RTT”
  • 12. ez.no Memcached vs Redis: Overview ๏Vivamus commodo ipsum in hendrerit iaculis. ๏Donec congue erat nibh, ac luctus erat accumsan tempor. ๏Mauris bibendum ac eros eu tempor. Duis libero libero, luctus quis posuere quis, porta vel turpis. ๏Sed augue dolor, laoreet eget turpis eget, laoreet vehicula neque. Donec sit amet dolor vel lorem ultrices facilisis ac sit amet velit. ๏Aenean nisi nisi, aliquet in pulvinar mollis, vulputate vitae nulla. Donec non ligula ac diam volutpat dapibus. ๏Aliquam eleifend turpis id ligula accumsan luctus. Donec sem justo, scelerisque eget condimentum ut, semper eget nulla. ๏Vivamus ultricies massa lectus, id varius orci sodales quis. Memcached Redis Multi operations (get, set, ..) V V Datatypes String String, List, Set, Hash, Sorted Set, … Streams Control over eviction X V Persistance X V Pipeline / Lua X V
 Not on Redis Cluster Multiserver V V
 Mainly Redis Cluster OR Redis Sentinel Multithreaded V X
 But multi process with Redis Cluster * * Redis 6 is adding partly threading with background thread handling slow operations
  • 13. ez.no Memcached vs Redis: “Greatly Simplified” Massive concurrent multi threaded, simple Key-Value store, that can take advantage of lots of CPU cores, and scales up across many servers VS Datastore for different advance data types to do sophisticated operations on, which is single threaded, but can be scaled up with Redis Cluster with some limitations to capabilities.
  • 14. Topics around:
 Redis & Redis Cluster
  • 15. Datatypes ๏ Strings ๏ Lists ๏ Sets ๏ SortedSets ๏ Hashes ๏ Bitmaps ๏ HyperLogLogs ๏ Streams (As of Redis 5.0)
  • 16. Commands ๏There are 227 commands and counting ๏There are generic key, cluster, connection, Pub/Sub, Scripting, Transaction commands ๏And Datatypes allows for specific operations, aka commands as well ๏For String it goes beyond flavors of GET / SET, there is e.g. APPEND, BITPOS, DECR, … ๏E.G. for "SET”: ๏SADD, SREM, SPOP ๏SCARD - Returns the set cardinality (number of elements) of the set stored at key ๏SDIFF, SINTER, SUNION, SMOVE ๏SMEMBERS, SSCAN
  • 17. Eviction maxmemory-policy: ๏noeviction ๏volatile-random ๏volatile-ttl ๏volatile-lru ๏volatile-lfu (As of Redis 4.0) ๏allkeys-random ๏allkeys-lru ๏allkeys-lfu (As of Redis 4.0)
  • 18. Redis Cluster: processe ๏Allows you to scale up Redis by running several instances ๏Multi process on same server and/or across servers ๏Coordinates cache across “cache slots", deals with replication, … ๏Unlike Memcached, several operations has limitations on Cluster
  • 19. Redis Cluster: limitations ๏Does not support “pipline”: capability to perform several operations in one call ๏PHPRedis mainly supports multi operations on MGET and MSET with cluster ๏Examples of affected operations: ๏RENAME won’t work if the new key ends up in another “Cache Slot” ๏EVAL (Lua Script) likewise can only be given keys that maps to same node ERR CROSSSLOT Keys in request don't hash to the same slot
  • 20. New in Symfony 4.3:
 FilesystemTagAwareAdapter & RedisTagAwareAdapter
  • 21. ez.no Tags storage ๏Moves tags to be a “relation” to cache key, instead of expiry time ๏Avoids the lookup on getItem(s), instead does it on invalidation ๏FilesystemTagAwareAdapter: ๏4.3: Symlinks for tag “relation”, 4.4: uses a file to list “relations” ๏RedisTagAwareAdapter: ๏Uses “Set” for tag “relation” ๏Forces a default expiry on cache which does not have expiry
  • 22. ez.no Why the efforts on 1-RTT lookups? ๏AWS ElasticCache Redis instances has latency of: ๏On larger EC2 instances: 0.2-0.5ms ๏On micro/small instances: Apparently more ๏When hitting backend time it takes to just wait for Redis: ๏Simple page with 20 items shown: ๏~40 lookups x latency = 5-20 ms ๏News site large landing page with 1000 items shown: ๏~2000 lookups x latency = 0.4 - 1 seconds
  • 23. ez.no In Symfony Cache: ๏Pipeline used instead of MGET => affecting Redis Cluster ๏Cache versioning lookups on Redis cluster ๏TagAwareAdapter micro ttl cache for tag lookups
 Lookup optimizations done over the last year
  • 24. ez.no On Application side (eZ Platform): ๏Changs take better advantage of Multi Get ๏Introduce optimized RedisTagAwareAdapter ๏Introduced Application specific in-memory cache
 Lookup optimizations done over the last year
  • 25. ez.no End result example: ๏Had 17.000 lookups in Symfony Cache on our Admin dashboard ๏Due to Symfony Cache logic this was ~40-60k lookups on Redis Cluster ๏30 seconds in worst case, just waiting for Redis Cluster ๏After all fixes it went down to 63 lookups in Symfony Cache Lookup optimizations done over the last year
  • 26. Let’s change symfon/demo to: Cache index posts Edit something in admin Look to cache commands to clear Add invalidation in Admin Let’s also connect to redis using redis-cli Play around and emulate SymfonyCache
  • 27. Edge cases, edge cases & Edge cases:
 Some things to be aware of
  • 28. ez.no Some edge cases ๏Race conditions ๏When caching data: Transactions ๏Async / Stale cache ๏RedisTagAwareAdapter: Sets never expire so use memory
  • 29. The End, Questions? Talk + Slides: https://joind.in/talk/c5187 Other talks: http://www.slideshare.net/andreromcke Twitter: @andrerom
 
 eZ Platform: https://ezplatform.com/ Redis: https://redis.io/ Memcached: https://memcached.org