SlideShare a Scribd company logo

Rationally boost your symfony2 application with caching tips and monitoring

Turin SymfonyDay, 5th October 2012 by @liuggio - I will try to keep the tips updated, I suggest you put this talk to your favorites. - Any comment or feedback are really appreciated.

1 of 54
Download to read offline
SYMFONY DAY
              TURIN 5th OCTOBER 2012


RATIONALLY BOOST YOUR SYMFONY2 APPLICATION

    WITH CACHING, TIPS AND MONITORING


         [/ @liuggio aka Giulio De Donato /]
NOT INVENTED HERE TALK

PLEASE SEE THE REFERENCES
Cache                 Optimization tips




             Symfony




Monitoring             Scaling Application
Cache                     Optimization tips




                Symfony




Monitoring                 Scaling Application




             Rationality
Cache                 Optimization tips




             Symfony




Monitoring             Scaling Application
What do you think if I say Cache _(disambiguation)?



             esi                                                           google
    Cookie
 vary shared cache proxy
                                                                           cache
                                                                           APC
Etag               cache
                                Invalidation
                             bytecode cache            fresh/stale
                                                    Memcache(d)
                                                                           Cookie        esi                fresh/stale
                                                                                                         Pipeline
                                                                                                                    clear
                           APC         CPU cache                           Cache hit/miss
                                        vary Etag
                                                                                                        burst
disk cache
google                                                        APC Etag                    CPU cache    cache          cache
cache    vary                DNS Cache             google
                                                   cache
                                                                           fresh/stale
                                                                                          shared
                                                                                          cache
                                                                                                       CPU cache
                           Etag
                                                    Redis
                                                               CPU cache


                                                                                                                     esi
                                                                           proxy
  Expiration                            Cookie
                           cache.manifest html5
                                                                     esi
                                                                           cache          disk cache
                                                                                          proxy
                                                                                                       DNS
                                                                                                        Cache vary
       Memcache(d)         CPU cache
                                 esi    APC            disk cache
                                                                           vary           cache           bytecode cache
                                                                                                             shared cache
Ad

Recommended

SSD based storage tuning for databases
SSD based storage tuning for databasesSSD based storage tuning for databases
SSD based storage tuning for databasesAngelo Rajadurai
 
[NHN] 성공적인 소셜게임 런칭과 기술
[NHN] 성공적인 소셜게임 런칭과 기술[NHN] 성공적인 소셜게임 런칭과 기술
[NHN] 성공적인 소셜게임 런칭과 기술GAMENEXT Works
 
Improving Your Heroku App Performance with Asset CDN and Unicorn
Improving Your Heroku App Performance with Asset CDN and UnicornImproving Your Heroku App Performance with Asset CDN and Unicorn
Improving Your Heroku App Performance with Asset CDN and UnicornSimon Bagreev
 
Koha installation BALID
Koha installation BALIDKoha installation BALID
Koha installation BALIDNur Ahammad
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
 

More Related Content

Viewers also liked

Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisRicard Clau
 
Effective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersEffective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersMarcin Chwedziak
 
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupScaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupKacper Gunia
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Ryan Weaver
 
Asynchronous processing with PHP and Symfony2. Do it simple
Asynchronous processing with PHP and Symfony2. Do it simpleAsynchronous processing with PHP and Symfony2. Do it simple
Asynchronous processing with PHP and Symfony2. Do it simpleKirill Chebunin
 
Techniques d'accélération des pages web
Techniques d'accélération des pages webTechniques d'accélération des pages web
Techniques d'accélération des pages webJean-Pierre Vincent
 
Get Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsGet Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsDavey Shafik
 
Automation using-phing
Automation using-phingAutomation using-phing
Automation using-phingRajat Pandit
 
Electrify your code with PHP Generators
Electrify your code with PHP GeneratorsElectrify your code with PHP Generators
Electrify your code with PHP GeneratorsMark Baker
 
The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)Matthias Noback
 
Top tips my_sql_performance
Top tips my_sql_performanceTop tips my_sql_performance
Top tips my_sql_performanceafup Paris
 
Why elasticsearch rocks!
Why elasticsearch rocks!Why elasticsearch rocks!
Why elasticsearch rocks!tlrx
 
Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015Marcello Duarte
 
Writing infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQLWriting infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQLGabriele Bartolini
 
Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015Bruno Boucard
 
L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)Arnauld Loyer
 

Viewers also liked (20)

Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
 
Effective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersEffective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 Developers
 
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupScaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
 
Asynchronous processing with PHP and Symfony2. Do it simple
Asynchronous processing with PHP and Symfony2. Do it simpleAsynchronous processing with PHP and Symfony2. Do it simple
Asynchronous processing with PHP and Symfony2. Do it simple
 
Elastic Searching With PHP
Elastic Searching With PHPElastic Searching With PHP
Elastic Searching With PHP
 
Diving deep into twig
Diving deep into twigDiving deep into twig
Diving deep into twig
 
Techniques d'accélération des pages web
Techniques d'accélération des pages webTechniques d'accélération des pages web
Techniques d'accélération des pages web
 
Get Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsGet Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP Streams
 
PHP5.5 is Here
PHP5.5 is HerePHP5.5 is Here
PHP5.5 is Here
 
Automation using-phing
Automation using-phingAutomation using-phing
Automation using-phing
 
Electrify your code with PHP Generators
Electrify your code with PHP GeneratorsElectrify your code with PHP Generators
Electrify your code with PHP Generators
 
The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)
 
Mocking Demystified
Mocking DemystifiedMocking Demystified
Mocking Demystified
 
Top tips my_sql_performance
Top tips my_sql_performanceTop tips my_sql_performance
Top tips my_sql_performance
 
Why elasticsearch rocks!
Why elasticsearch rocks!Why elasticsearch rocks!
Why elasticsearch rocks!
 
Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015
 
Writing infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQLWriting infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQL
 
Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015
 
L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)
 

Similar to Rationally boost your symfony2 application with caching tips and monitoring

Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsDavide Carnevali
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010isnull
 
Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsKaliop-slide
 
Caching Data For Performance
Caching Data For PerformanceCaching Data For Performance
Caching Data For PerformanceDave Ross
 
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESSpring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESMichael Plöd
 
Heapoff memory wtf
Heapoff memory wtfHeapoff memory wtf
Heapoff memory wtfOlivier Lamy
 
Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupaldigital006
 
Teradata memory management - A balancing act
Teradata memory management  -  A balancing actTeradata memory management  -  A balancing act
Teradata memory management - A balancing actShaheryar Iqbal
 
Share point 2013 distributed cache
Share point 2013 distributed cacheShare point 2013 distributed cache
Share point 2013 distributed cacheMichael Nokhamzon
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Wim Godden
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APCBen Ramsey
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsEnrico Zimuel
 
eZ Publish Caching Mechanisms
eZ Publish Caching MechanismseZ Publish Caching Mechanisms
eZ Publish Caching MechanismsKaliop-slide
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEduardo Pelegri-Llopart
 
Bcache and Aerospike
Bcache and AerospikeBcache and Aerospike
Bcache and AerospikeAnshu Prateek
 
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for WindowsFord AntiTrust
 
Spark 2.x Troubleshooting Guide
Spark 2.x Troubleshooting GuideSpark 2.x Troubleshooting Guide
Spark 2.x Troubleshooting GuideIBM
 

Similar to Rationally boost your symfony2 application with caching tips and monitoring (20)

Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limits
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010
 
Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching Mechanisms
 
Caching Data For Performance
Caching Data For PerformanceCaching Data For Performance
Caching Data For Performance
 
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICESSpring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
 
Apc Memcached Confoo 2011
Apc Memcached Confoo 2011Apc Memcached Confoo 2011
Apc Memcached Confoo 2011
 
Heapoff memory wtf
Heapoff memory wtfHeapoff memory wtf
Heapoff memory wtf
 
Cache all the things - A guide to caching Drupal
Cache all the things - A guide to caching DrupalCache all the things - A guide to caching Drupal
Cache all the things - A guide to caching Drupal
 
Teradata memory management - A balancing act
Teradata memory management  -  A balancing actTeradata memory management  -  A balancing act
Teradata memory management - A balancing act
 
Share point 2013 distributed cache
Share point 2013 distributed cacheShare point 2013 distributed cache
Share point 2013 distributed cache
 
Os Gopal
Os GopalOs Gopal
Os Gopal
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applications
 
eZ Publish Caching Mechanisms
eZ Publish Caching MechanismseZ Publish Caching Mechanisms
eZ Publish Caching Mechanisms
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage Patterns
 
Bcache and Aerospike
Bcache and AerospikeBcache and Aerospike
Bcache and Aerospike
 
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
 
PostgreSQL Query Cache - "pqc"
PostgreSQL Query Cache - "pqc"PostgreSQL Query Cache - "pqc"
PostgreSQL Query Cache - "pqc"
 
Spark 2.x Troubleshooting Guide
Spark 2.x Troubleshooting GuideSpark 2.x Troubleshooting Guide
Spark 2.x Troubleshooting Guide
 

More from Giulio De Donato

Docker italia fatti un container tutto tuo
Docker italia fatti un container tutto tuoDocker italia fatti un container tutto tuo
Docker italia fatti un container tutto tuoGiulio De Donato
 
Lets isolate a process with no container like docker
Lets isolate a process with no container like dockerLets isolate a process with no container like docker
Lets isolate a process with no container like dockerGiulio De Donato
 
More developers on DevOps with Docker orchestration
More developers on DevOps with Docker orchestrationMore developers on DevOps with Docker orchestration
More developers on DevOps with Docker orchestrationGiulio De Donato
 
really really really awesome php application with bdd behat and iterfaces
really really really awesome php application with bdd behat and iterfacesreally really really awesome php application with bdd behat and iterfaces
really really really awesome php application with bdd behat and iterfacesGiulio De Donato
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microserviceGiulio De Donato
 
Json web token api authorization
Json web token api authorizationJson web token api authorization
Json web token api authorizationGiulio De Donato
 
Think horizontally ood, ddd and bdd
Think horizontally ood, ddd and bddThink horizontally ood, ddd and bdd
Think horizontally ood, ddd and bddGiulio De Donato
 
I came i saw i go - golang it meetup codemotion rome 2014
I came i saw i go - golang it meetup codemotion rome 2014I came i saw i go - golang it meetup codemotion rome 2014
I came i saw i go - golang it meetup codemotion rome 2014Giulio De Donato
 
Benchmark Profile and Boost your Symfony application
Benchmark Profile and Boost your Symfony applicationBenchmark Profile and Boost your Symfony application
Benchmark Profile and Boost your Symfony applicationGiulio De Donato
 
Leaphly fight monolothic today
Leaphly fight monolothic todayLeaphly fight monolothic today
Leaphly fight monolothic todayGiulio De Donato
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecGiulio De Donato
 
Design pattern in Symfony2 - Nanos gigantium humeris insidentes
Design pattern in Symfony2 - Nanos gigantium humeris insidentesDesign pattern in Symfony2 - Nanos gigantium humeris insidentes
Design pattern in Symfony2 - Nanos gigantium humeris insidentesGiulio De Donato
 
Caching and data analysis will move your Symfony2 application to the next level
Caching and data analysis will move your Symfony2 application to the next levelCaching and data analysis will move your Symfony2 application to the next level
Caching and data analysis will move your Symfony2 application to the next levelGiulio De Donato
 

More from Giulio De Donato (13)

Docker italia fatti un container tutto tuo
Docker italia fatti un container tutto tuoDocker italia fatti un container tutto tuo
Docker italia fatti un container tutto tuo
 
Lets isolate a process with no container like docker
Lets isolate a process with no container like dockerLets isolate a process with no container like docker
Lets isolate a process with no container like docker
 
More developers on DevOps with Docker orchestration
More developers on DevOps with Docker orchestrationMore developers on DevOps with Docker orchestration
More developers on DevOps with Docker orchestration
 
really really really awesome php application with bdd behat and iterfaces
really really really awesome php application with bdd behat and iterfacesreally really really awesome php application with bdd behat and iterfaces
really really really awesome php application with bdd behat and iterfaces
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microservice
 
Json web token api authorization
Json web token api authorizationJson web token api authorization
Json web token api authorization
 
Think horizontally ood, ddd and bdd
Think horizontally ood, ddd and bddThink horizontally ood, ddd and bdd
Think horizontally ood, ddd and bdd
 
I came i saw i go - golang it meetup codemotion rome 2014
I came i saw i go - golang it meetup codemotion rome 2014I came i saw i go - golang it meetup codemotion rome 2014
I came i saw i go - golang it meetup codemotion rome 2014
 
Benchmark Profile and Boost your Symfony application
Benchmark Profile and Boost your Symfony applicationBenchmark Profile and Boost your Symfony application
Benchmark Profile and Boost your Symfony application
 
Leaphly fight monolothic today
Leaphly fight monolothic todayLeaphly fight monolothic today
Leaphly fight monolothic today
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
Design pattern in Symfony2 - Nanos gigantium humeris insidentes
Design pattern in Symfony2 - Nanos gigantium humeris insidentesDesign pattern in Symfony2 - Nanos gigantium humeris insidentes
Design pattern in Symfony2 - Nanos gigantium humeris insidentes
 
Caching and data analysis will move your Symfony2 application to the next level
Caching and data analysis will move your Symfony2 application to the next levelCaching and data analysis will move your Symfony2 application to the next level
Caching and data analysis will move your Symfony2 application to the next level
 

Recently uploaded

Apex Replay Debugger and Salesforce Platform Events.pptx
Apex Replay Debugger and Salesforce Platform Events.pptxApex Replay Debugger and Salesforce Platform Events.pptx
Apex Replay Debugger and Salesforce Platform Events.pptxmohayyudin7826
 
My Journey towards Artificial Intelligence
My Journey towards Artificial IntelligenceMy Journey towards Artificial Intelligence
My Journey towards Artificial IntelligenceVijayananda Mohire
 
LF Energy Webinar: Introduction to TROLIE
LF Energy Webinar: Introduction to TROLIELF Energy Webinar: Introduction to TROLIE
LF Energy Webinar: Introduction to TROLIEDanBrown980551
 
IT Nation Evolve event 2024 - Quarter 1
IT Nation Evolve event 2024  - Quarter 1IT Nation Evolve event 2024  - Quarter 1
IT Nation Evolve event 2024 - Quarter 1Inbay UK
 
Battle of React State Managers in frontend applications
Battle of React State Managers in frontend applicationsBattle of React State Managers in frontend applications
Battle of React State Managers in frontend applicationsEvangelia Mitsopoulou
 
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes", Volodymyr TsapFwdays
 
"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro Kozhevin
"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro Kozhevin"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro Kozhevin
"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro KozhevinFwdays
 
How to write an effective Cyber Incident Response Plan
How to write an effective Cyber Incident Response PlanHow to write an effective Cyber Incident Response Plan
How to write an effective Cyber Incident Response PlanDatabarracks
 
Relationship Counselling: From Disjointed Features to Product-First Thinking ...
Relationship Counselling: From Disjointed Features to Product-First Thinking ...Relationship Counselling: From Disjointed Features to Product-First Thinking ...
Relationship Counselling: From Disjointed Features to Product-First Thinking ...Product School
 
Bit N Build Poland
Bit N Build PolandBit N Build Poland
Bit N Build PolandGDSC PJATK
 
Are Human-generated Demonstrations Necessary for In-context Learning?
Are Human-generated Demonstrations Necessary for In-context Learning?Are Human-generated Demonstrations Necessary for In-context Learning?
Are Human-generated Demonstrations Necessary for In-context Learning?MENGSAYLOEM1
 
My sample product research idea for you!
My sample product research idea for you!My sample product research idea for you!
My sample product research idea for you!KivenRaySarsaba
 
"Platform Engineering with Development Containers", Igor Fesenko
"Platform Engineering with Development Containers", Igor Fesenko"Platform Engineering with Development Containers", Igor Fesenko
"Platform Engineering with Development Containers", Igor FesenkoFwdays
 
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERNRonnelBaroc
 
"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura Rochniak"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura RochniakFwdays
 
10 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 202410 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 2024Thijs Feryn
 
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17Ana-Maria Mihalceanu
 
Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...
Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...
Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...Product School
 
"AIRe - AI Reliability Engineering", Denys Vasyliev
"AIRe - AI Reliability Engineering", Denys Vasyliev"AIRe - AI Reliability Engineering", Denys Vasyliev
"AIRe - AI Reliability Engineering", Denys VasylievFwdays
 

Recently uploaded (20)

Apex Replay Debugger and Salesforce Platform Events.pptx
Apex Replay Debugger and Salesforce Platform Events.pptxApex Replay Debugger and Salesforce Platform Events.pptx
Apex Replay Debugger and Salesforce Platform Events.pptx
 
My Journey towards Artificial Intelligence
My Journey towards Artificial IntelligenceMy Journey towards Artificial Intelligence
My Journey towards Artificial Intelligence
 
In sharing we trust. Taking advantage of a diverse consortium to build a tran...
In sharing we trust. Taking advantage of a diverse consortium to build a tran...In sharing we trust. Taking advantage of a diverse consortium to build a tran...
In sharing we trust. Taking advantage of a diverse consortium to build a tran...
 
LF Energy Webinar: Introduction to TROLIE
LF Energy Webinar: Introduction to TROLIELF Energy Webinar: Introduction to TROLIE
LF Energy Webinar: Introduction to TROLIE
 
IT Nation Evolve event 2024 - Quarter 1
IT Nation Evolve event 2024  - Quarter 1IT Nation Evolve event 2024  - Quarter 1
IT Nation Evolve event 2024 - Quarter 1
 
Battle of React State Managers in frontend applications
Battle of React State Managers in frontend applicationsBattle of React State Managers in frontend applications
Battle of React State Managers in frontend applications
 
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
 
"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro Kozhevin
"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro Kozhevin"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro Kozhevin
"DevOps Practisting Platform on EKS with Karpenter autoscaling", Dmytro Kozhevin
 
How to write an effective Cyber Incident Response Plan
How to write an effective Cyber Incident Response PlanHow to write an effective Cyber Incident Response Plan
How to write an effective Cyber Incident Response Plan
 
Relationship Counselling: From Disjointed Features to Product-First Thinking ...
Relationship Counselling: From Disjointed Features to Product-First Thinking ...Relationship Counselling: From Disjointed Features to Product-First Thinking ...
Relationship Counselling: From Disjointed Features to Product-First Thinking ...
 
Bit N Build Poland
Bit N Build PolandBit N Build Poland
Bit N Build Poland
 
Are Human-generated Demonstrations Necessary for In-context Learning?
Are Human-generated Demonstrations Necessary for In-context Learning?Are Human-generated Demonstrations Necessary for In-context Learning?
Are Human-generated Demonstrations Necessary for In-context Learning?
 
My sample product research idea for you!
My sample product research idea for you!My sample product research idea for you!
My sample product research idea for you!
 
"Platform Engineering with Development Containers", Igor Fesenko
"Platform Engineering with Development Containers", Igor Fesenko"Platform Engineering with Development Containers", Igor Fesenko
"Platform Engineering with Development Containers", Igor Fesenko
 
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
 
"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura Rochniak"Testing of Helm Charts or There and Back Again", Yura Rochniak
"Testing of Helm Charts or There and Back Again", Yura Rochniak
 
10 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 202410 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 2024
 
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17
 
Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...
Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...
Harnessing the Power of GenAI for Exceptional Product Outcomes by Booking.com...
 
"AIRe - AI Reliability Engineering", Denys Vasyliev
"AIRe - AI Reliability Engineering", Denys Vasyliev"AIRe - AI Reliability Engineering", Denys Vasyliev
"AIRe - AI Reliability Engineering", Denys Vasyliev
 

Rationally boost your symfony2 application with caching tips and monitoring

  • 1. SYMFONY DAY TURIN 5th OCTOBER 2012 RATIONALLY BOOST YOUR SYMFONY2 APPLICATION WITH CACHING, TIPS AND MONITORING [/ @liuggio aka Giulio De Donato /]
  • 2. NOT INVENTED HERE TALK PLEASE SEE THE REFERENCES
  • 3. Cache Optimization tips Symfony Monitoring Scaling Application
  • 4. Cache Optimization tips Symfony Monitoring Scaling Application Rationality
  • 5. Cache Optimization tips Symfony Monitoring Scaling Application
  • 6. What do you think if I say Cache _(disambiguation)? esi google Cookie vary shared cache proxy cache APC Etag cache Invalidation bytecode cache fresh/stale Memcache(d) Cookie esi fresh/stale Pipeline clear APC CPU cache Cache hit/miss vary Etag burst disk cache google APC Etag CPU cache cache cache cache vary DNS Cache google cache fresh/stale shared cache CPU cache Etag Redis CPU cache esi proxy Expiration Cookie cache.manifest html5 esi cache disk cache proxy DNS Cache vary Memcache(d) CPU cache esi APC disk cache vary cache bytecode cache shared cache
  • 7. “Great caching is like great sex. It hides all the real problems” Vivek Haldar
  • 8. Cache_(disambiguation) Wikipedia: “a Cache ( /’kæ∫/ KASH[1]) is a component that transparently stores data so that future requests for that data can be served faster.” A Cache Hit happens if the Cache contains the answer. A Cache Miss happens if the Cache doesn’t contain the answer. The perfect Cache - definition A Cache is perfect when given the same request the Cache miss happens once. || given the same request the response is not ‘processed’ twice. A Cache is perfect when the Cache miss happens once for the same response.
  • 9. Cache The Cache is a matter of response
  • 10. Cache && Symfony 2 — Application caching: app/cache and APC — Response caching and HTTP-CACHE — Doctrine2 Query and Result Caching — CDN and static files — Other
  • 11. Cache && Symfony 2 — app/cache Terravison vendor folder is about 340 MB The app/cache/prod folder is about 3000 files 1. Annotation (Entity/Controller/...) 2. Template a. name => file b. twig in php 3. Assetic (definition) 4. Url matcher, Url creator 5. Translations array key=>value 6. Doctrine Entity Proxy 7. Your Bundle!
  • 12. Cache && Symfony 2 — app/cache Build your own CacheWarmer namespace SymfonyComponentHttpKernelCacheWarmer; interface CacheWarmerInterface /** * Warms up the cache. * @param string $cacheDir The cache directory */ public function warmUp($cacheDir); public function isOptional() Add your class to the services with the tag kernel.cache_warmer Note: the CacheWarmerInterface is not properly the same as the snippet.
  • 13. Cache && Symfony2 — HTTP CACHE symfony.com/doc/master/book/http_cache.html Symfony2 is a web framework built from scratch around the http specification — a resource could be Fresh || Stale — http-caching only on safe method — validation || expiration
  • 14. Cache && Symfony 2 — HTTP CACHE Real world example Reverse Proxy Shared Cache Cache Browser Private Shared Cache Shared Cache Client Server
  • 15. Cache && Symfony 2 — HTTP CACHE symfony.com/doc/master/book/http_cache.html $response->setPublic() //default is private $response->setMaxAge(600); // Same as above but only for shared caches $response->setSharedMaxAge(600); $response->setETag(md5($response->getContent())); $response->setLastModified($datetime); if ($response->isNotModified($this->getRequest())) {return $response;} else { // create a fresh response } $response->setVary(‘Accept-Encoding’);
  • 16. Cache && Symfony 2 — Doctrine The least expensive query is the query you never run.
  • 17. Cache && Symfony 2 — Doctrine DoctrineCommonCacheCache // Fetches an entry from the cache. string function fetch($id); // Test if an entry exists in the cache. bool function contains($id); // Puts data into the cache. bool function save($id, $data, $lifeTime); // Deletes a cache entry. bool function delete($id);
  • 18. Cache && Symfony 2 — Doctrine Using Doctrine: MetaData Cache Annotation (APC) Query Cache DQL parsed into SQL (APC/REDIS/MEMCACHED) Result Cache The query result (REDIS/MEMCACHED/APC)
  • 19. Symfony 2 real example symfony.com/doc/current/book/doctrine.html Class ProductRepository ... $query = $this->createQueryBuilder(‘p’) ->where(‘p.price > :price’) ->setParameter(‘price’, ‘19.99’) ->getQuery(); $products = $query->getResult();
  • 20. Symfony 2 real example symfony.com/doc/current/book/doctrine.html Class ProductRepository ... $query = $this->createQueryBuilder(‘p’) ->where(‘p.price > :price’) ->setParameter(‘price’, ‘19.99’) ->getQuery(); $query->useResultCache( true, $lifetime, __METHOD__ . serialize($query->getParameters()) ); $query->useQueryCache(); $products = $query->getResult();
  • 21. “There are only two hard things in Computer Science: cache invalidation and naming things” Phil Karlton
  • 22. Cache Problem Invalidation Especially for http, but in general, you should not waste time to invalidate a value, but you should invest resources to find the right time of validity. Cache miss storm When a resource is no longer available (cache miss), and is required by many clients simultaneously (storm), a congestion happens. cache miss storm, cache stampede, dog-piling, APC Cache slam Uniqueness of the cache key Attention to the conflicts in the key definition, always put a prefix or namespace such as language or role.
  • 23. Cache Optimization tips Symfony Monitoring Scaling Application
  • 24. Tips Easy rules: — The user should never wait, slow operation data in a queue (Redis/*MQ) processed by a consumer (cli + supersivord): —> Image Manipulation —> File Creation (pdf) —> Sending email as spool —> Log — Use Session with Redis/Memcache — Caution on what do you do in the loop && nested loop — Attention on every I/O — If there are to many “IF” the function may have an OOP problem — Think before Flush while{$em->persist(); $em->flush(); }
  • 25. Tips — APC Setting ‘apc.stat=0‘ You should clear the cache after changing the code, when you deploy you should do it after the event ‘symfony:cache:clear‘ the ‘userx’ should restart php-fpm||apache gracefully, simply add to /etc/sudoers userx ALL=(root) NOPASSWD: /usr/sbin/service apache2ctl graceful or use the command ‘php -r “apc_clear_cache();”‘
  • 26. Tips — Autoloader Improve the autoloader performance: $ composer.phar dumpautoload --optimize This autoloader needs maintenance, execute the command during the deploy after the event ‘symfony:assets:install‘
  • 27. Tips — Cache Common Use APC in order to save your custom data # config.ymlservices: cache: class: DoctrineCommonCacheApcCache In the Controller if ($fooString = $this->get(‘cache’)->fetch(‘foo’)) { $foo = unserialize($fooString); } else { // do the work $this->get(‘cache’)->save(‘foo’, serialize($foo)); }
  • 28. Tips — Doctrine The associations are LAZY by default // Order /** * @ManyToOne(targetEntity=”Cart”, cascade={“all”}, fetch=”EAGER”) */ private $cart; If you want to change the fetch mode <?php $query = $em->createQuery(“SELECT o FROM MyProjectOrder o”); $query->setFetchMode(“MyProjectOrder”, “Cart”, “LAZY”); $query->execute();
  • 29. Tips — Doctrine > 2.1 What’s better then LAZY? /* * @ORMManyToMany(targetEntity=”Trips”, mappedBy=”rides”,fetch=”EXTRA_LAZY”) */ private $trips; $turin->getTrips()->contains($turinCaselle); $turin->getTrips()->count(); $turin->getTrips()->slice($offset, $length);
  • 30. Tips — Doctrine > 2.1 Read Only Entity /** * @ORMEntity * @ORMREADONLY */ class Status
  • 31. Tips — Doctrine The wise use the reference $post = $postRepository->find($postId); $comment->setPost($post); $comment>addPost( $em->getReference(‘AcmeBundleEntityPost’, $postId) );
  • 32. Tips — Route / Virtual host http://symfony.com/doc/2.0/cookbook/configuration/external_parameters.htm $ app/console router:dump-apache --env=prod # _welcome RewriteCond %{REQUEST_URI} ^/$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:_welcome, E=_ROUTING_DEFAULTS__controller: AcmeDemoBundleControllerWelcomeController:: indexAction] Insert the routes into the virtual host, they will become items of the global $_SERVER variable, and the ApacheUrlMatcher will read it. You could set external parameters directly into the virtual host <VirtualHost *:80> ServerName Symfony2 SetEnv SYMFONY__DATABASE__USER user SetEnv SYMFONY__DATABASE__PASSWORD secret
  • 33. Tips — Monolog http://symfony.com/doc/2.0/reference/dic_tags.html#dic-tags-monolog my_service: class: FullyQualifiedLoaderClassName arguments: [@logger] tags: - { name: monolog.logger, channel: acme } monolog: handlers: acme: type: stream path: /var/log/acme.log channels: acme doctrine: type: stream path: /var/log/doctrine.log channels: doctrine
  • 34. Tips Http-Microcaching: — Save all the responses for 1 second lot of examples on internet for Nginx Query Caching : — Don’t use ‘now()’ but date(‘y-m-d’) — Don’t use mysql rand() Twig : — Render with namespace — Controller can be embedded asyncronously using the javascript library hinclude.js. {% render ‘...:news’ with {}, {‘standalone’: ‘js’} %}
  • 35. “get your assets in line” Kriss Wallsmith
  • 36. Tips — Assetic http://symfony.com/doc/current/cookbook/assetic/asset_management.html Asset Managment for PHP : — Minify and combine all of your CSS and JS files — Run all (or just some) of your CSS or JS files through some sort of compiler, such as LESS, SASS or CoffeeScript — Run image optimizations on your images
  • 37. Tips — Assetic && Cloud {%- javascripts ‘@ ... /public/calendar.js’ ‘@ ... /public/base.js’ filter=”yui_js” package=’cdn’ %}<script type=”text/javascript” src=”{{ asset_url }}”></script> {% endjavascripts %} # config.yml assetic: write_to: %cdn_protocol%://%cdn_container_name% assets: common: inputs: [public/calendar.js, public/base.js] package: cdn filters: {yui_js} <script type=”text/javascript” src=”{{ assets/common.js }}”></script> <script type=”text/javascript” src=”http://2dabf16.r6.cdn.eu/js/75a9295.js?20120904110916”></script>
  • 38. Tips — Assetic && cloud # config.yml framework: templating: engines: ... packages: cdn: version: 20120904110916 version_format: ~ base_urls: http: [%cdn_container_url%] ssl: [%cdn_contailner_ssl_url%] assetic: write_to: %cdn_protocol%://%cdn_container_name% assets: common: inputs: [public/calendar.js, public/base.js] package: cdn filters: {yui_js}
  • 40. Did you really need it?
  • 42. “Knowing when optimization is premature defines the differences the master engineer and the apprenctice” Theo Schlossnagle
  • 43. Cache Optimization tips Symfony Monitoring Scaling Application
  • 44. Profiling => Rationality Know the problem in dev — xdebug — symfony profiler in prod — xhprof — monitoring and statistics — Server monitoring (Nagios/Cacti/NewRelic/...) — Application monitoring (Statsd/NewRelic/...)
  • 45. Application monitoring: The servers that you need StatsD — Node.JS daemon. Listens for message over UDP simple daemon for easy stats aggregation. Graphite — Real-time graphing system — Components: — Carbon stores the data in Graphite’s specialized database. — The data can then be visualized through graphite’s web interfaces developed with django. — Whisper allows carbon to write multiple data points.
  • 46. Application monitoring: Installing: Statsd + Graphite + Carbon + Whisper Symfony2 + StatsdClientBundle Using Vagrant is **** easy: $ gem install vagrant $ git clone https://github.com/liuggio/vagrant-statsd- graphite-puppet.git $ cd vagrant-statsd-graphite-puppet.git $ vagrant up now install Symfony2 with StatsdClientBundle $ php composer.phar create-project symfony/framework-standard- edition $ composer require liuggio/statsd-client-bundle add the bundle into the appKernel, copy/paste the configuration and ...
  • 47. Symfony 2 && StatsDClientBundle
  • 48. Symfony 2 && StatsDClientBundle http://localhost:8080
  • 49. Cache Optimization tips Symfony Monitoring Scaling Application
  • 50. “It won’t scale if it’s not designed to scale” David Mitzenmacher
  • 52. Scaling OOP Developing / SOA / EDA “The real world can be accurately described as a collection of objects that interact” Use the concepts from the OOP also for the services: — Single Responsability Principle — Open Close Principle — Law of Demeter — Don’t overcomplicate SOA: Service Oriented Architecture EDA: Event Driven Architecture
  • 53. Conclusions — COULD — Use the cache — COULD — Optimize your application — SHOULD — Monitor your Servers/Applications — MUST — Follow the OOP/SOA
  • 54. References http://tools.ietf.org/html/draft-ietf-httpbis-p6-cache-18 https://developers.google.com/speed/docs/best-practices/caching http://notmysock.org/blog/php/user-cache-timebomb.html http://sonata-project.org/blog/2012/5/15/assetic-package-configuration http://www.slideshare.net/jonkruger/advanced-objectorientedsolid-principles http://sonata-project.org/bundles/notification/2-0/doc/index.html http://slides.seld.be/?file=2011-10-20+High+Performance+Websites+with+Symfony2.html http://stackoverflow.com/questions/8893081/how-to-cache-in-symfony-2 http://www.slideshare.net/postwait/scalable-internet-architecture http://techportal.inviqa.com/2009/12/01/profiling-with-xhprof/ http://www.mysqlperformanceblog.com/2010/09/10/cache-miss-storm http://www.slideshare.net/iamcal/scalable-web-architectures-common-patterns-ap... http://blog.servergrove.com/2012/04/18/how-to-create-a-cache-warmer-in-symfony2/ http://www.slideshare.net/jwage/doctrine-intherealworldsf-live2011sanfran http://www.slideshare.net/quipo/scalable-architectures-taming-the-twitter-firehose https://github.com/liuggio/StatsDClientBundle