Symfony e grandi numeri
Si...può...fare!

Daniel Londero
daniel.londero@sth.it
Chi sono

Daniel Londero


➢   Sviluppatore PHP dal 2005 @

➢   (s|S)ymfony framework

➢   PUG Friuli

➢   Runner
2M
         500k
5M                       300k

       10k   10M
200k

             50k        100k
Calciomercato.com: la storia

➢   Nasce nel 1996

➢   Nel 2006 arriva in STH

➢   Nel 2010 si passa a symfony 1.4

➢   12 aprile 2010 revision 1

➢   10 giugno 2010: deploy (22 ore)
I numeri

               UTENTI UNICI   PAGINE VISTE
                 AL MESE        AL MESE


AGOSTO 2010      3,6M            36M

GENNAIO 2011     3,3M            32M

MARZO 2011       2,2M            28M
Perchè symfony?

➢   Opensource

➢   Community

➢   Documentato

➢   Test

➢   Best practice (MVC / DRY / KISS / ...)
Symfony e grandi numeri: si può fare!
Symfony e grandi numeri: si può fare!
#GAC
APPLICATION

                     LOAD BALANCER


MEMCACHED     MEMCACHED
                                                            BE
  NGINX 1       NGINX N
                                   NGINX 1   NGINX N
 PHP FCGI       PHP FCGI


   APC              APC


                                                             DATA

         LOAD BALANCER

                                               NFS
MASTER      SLAVE    ...   SLAVE
  DB         DB1            DBN
LOAD BALANCER


MEMCACHED     MEMCACHED
                                                       BE
  NGINX 1       NGINX N
                                   NGINX 1   NGINX N
 PHP FCGI       PHP FCGI


   APC              APC



         LOAD BALANCER

                                               NFS
MASTER      SLAVE    ...   SLAVE
  DB         DB1            DBN
Scalare: orizzontale vs verticale

Orizzontale
➢ Aggiungo macchine

➢ Aumenta complessità

➢ Costi e rischi più bassi




Verticale
➢ Aggiungo risorse

➢ Bassa complessità

➢ Costi e rischi elevati
Gestione delle sessioni


➢   Balancer persistenti

➢   NFS (sconsigliato)

➢   Database

➢   Memcached (Redis dalla 2.4)
LOAD BALANCER


MEMCACHED     MEMCACHED
                                                       BE
  NGINX 1       NGINX N
                                   NGINX 1   NGINX N
 PHP FCGI       PHP FCGI


   APC              APC



         LOAD BALANCER

                                               NFS
MASTER      SLAVE    ...   SLAVE
  DB         DB1            DBN
Cache storage system
➢   SfFileCache (default)

➢   SfAPCCache

➢   SfEAcceleratorCache

➢   SfMemcacheCache

➢   SfSQLiteCache

➢   sfXCacheCache
“There are only two hard things in Computer
Science: cache invalidation and naming things”
                                  - Phil Karlton
Cache pagina
Cache Partial e Component
Contatori

Sfruttare la velocità di accesso alla memoria per
sollevare i database da operazioni inutili.

➢   Impression sui banner

➢   Letture articoli

➢   Voti per i sondaggi
LOAD BALANCER


MEMCACHED     MEMCACHED
                                                       BE
  NGINX 1       NGINX N
                                   NGINX 1   NGINX N
 PHP FCGI       PHP FCGI


   APC              APC



         LOAD BALANCER

                                               NFS
MASTER      SLAVE    ...   SLAVE
  DB         DB1            DBN
LOAD BALANCER


MEMCACHED     MEMCACHED
                                                       BE
  NGINX 1       NGINX N
                                   NGINX 1   NGINX N
 PHP FCGI       PHP FCGI


   APC              APC



         LOAD BALANCER

                                               NFS
MASTER      SLAVE    ...   SLAVE
  DB         DB1            DBN
sfMasterSlavePlugin
all:
 master:
   class: sfDoctrineDatabase
   param:
     dsn:    mysql:dbname=database;host:master.example.com
     username: root
     password: ~
 slave:
   class: sfDoctrineDatabase
   param:
     dsn:    mysql:dbname=database;host:slave.example.com
     username: root
     password: ~

dev:
 master: &master
  class: sfDoctrineDatabase
  param:
    dsn:    mysql:dbname=database;host=localhost
    username: root
    password: ~
 slave: *master
Strumenti utili


➢   Web debug toolbar

➢   Slow query log

➢   Explain

➢   Live on stage (and dev)
LOAD BALANCER


MEMCACHED     MEMCACHED
                                                       BE
  NGINX 1       NGINX N
                                   NGINX 1   NGINX N
 PHP FCGI       PHP FCGI


   APC              APC



         LOAD BALANCER

                                               NFS
MASTER      SLAVE    ...   SLAVE
  DB         DB1            DBN
LOAD BALANCER


MEMCACHED     MEMCACHED
                                                       BE
  NGINX 1       NGINX N
                                   NGINX 1   NGINX N
 PHP FCGI       PHP FCGI


   APC              APC



         LOAD BALANCER

                                               NFS
MASTER      SLAVE    ...   SLAVE
  DB         DB1            DBN
Symfony e grandi numeri: si può fare!
Credits e link
http://www.flickr.com/photos/theplanetdotcom/4879419788

http://www.php.net/manual/en/book.memcache.php

http://www.symfony-project.org/reference/1_4/en/05-Factories

http://www.symfony-project.org/gentle-introduction/1_4/en/12-Caching

http://www.symfony-project.org/jobeet/1_4/Doctrine/en/21

http://www.symfony-project.org/plugins/sfDoctrineMasterSlavePlugin

http://dev.mysql.com/doc/refman/5.6/en/slow-query-log.html

http://dev.mysql.com/doc/refman/5.6/en/explain.html
Grazie. Attendo feedback...


              Votate questo talk
              http://joind.in/3024



                Contattatemi
daniel.londero@sth.it | @dlondero | phpblog.it

More Related Content

PDF
Application Caching: The Hidden Microservice (SAConf)
PDF
EVCache: Lowering Costs for a Low Latency Cache with RocksDB
PDF
EVCache & Moneta (GoSF)
PDF
GFProxy: Scaling the GlusterFS FUSE Client
PDF
G1: To Infinity and Beyond
PDF
Accelerating HBase with NVMe and Bucket Cache
ODP
Leases and-caching final
PDF
WordPress Powered by AMIMOTO HHVM
Application Caching: The Hidden Microservice (SAConf)
EVCache: Lowering Costs for a Low Latency Cache with RocksDB
EVCache & Moneta (GoSF)
GFProxy: Scaling the GlusterFS FUSE Client
G1: To Infinity and Beyond
Accelerating HBase with NVMe and Bucket Cache
Leases and-caching final
WordPress Powered by AMIMOTO HHVM

What's hot (20)

PDF
Native Clients, more the merrier with GFProxy!
ODP
Gluster technical overview
ODP
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
PDF
Request-Oriented Durable Write Caching for Application Performance (USENIX AT...
PDF
Object Compaction in Cloud for High Yield
ODP
Lcna tutorial-2012
PDF
Sdc 2012-challenges
ODP
Scale out backups-with_bareos_and_gluster
PDF
Smb gluster devmar2013
ODP
Developing apps and_integrating_with_gluster_fs_-_libgfapi
PPTX
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
ODP
Accelerate your web app with a layer of Varnish
ODP
Gluster intro-tdose
PDF
XMPP & AMQP
PDF
[POSS 2019] OVirt and Ceph: Perfect Combination.?
ODP
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
PDF
Rust's Journey to Async/await
PDF
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
PDF
gRPC & Kubernetes
ODP
20160130 Gluster-roadmap
Native Clients, more the merrier with GFProxy!
Gluster technical overview
GlusterD 2.0 - Managing Distributed File System Using a Centralized Store
Request-Oriented Durable Write Caching for Application Performance (USENIX AT...
Object Compaction in Cloud for High Yield
Lcna tutorial-2012
Sdc 2012-challenges
Scale out backups-with_bareos_and_gluster
Smb gluster devmar2013
Developing apps and_integrating_with_gluster_fs_-_libgfapi
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
Accelerate your web app with a layer of Varnish
Gluster intro-tdose
XMPP & AMQP
[POSS 2019] OVirt and Ceph: Perfect Combination.?
GlusterFs Architecture & Roadmap - LinuxCon EU 2013
Rust's Journey to Async/await
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
gRPC & Kubernetes
20160130 Gluster-roadmap
Ad

Similar to Symfony e grandi numeri: si può fare! (20)

PDF
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
KEY
Drupal High Availability High Performance 2012
PDF
Develop and deploy using Hybrid Cloud Strategies confoo2012
KEY
Wordpress Meetup ISCTE
PDF
Nginx pres
PPTX
Why You Should Choose a Software-Based Load Balancer
PDF
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
PDF
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
KEY
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
PPTX
Case Study with Answers.com on Scaling with Memcached and MySQL
PPTX
Designing enterprise drupal
PDF
PHP in the Cloud
ODP
Caching and tuning fun for high scalability
PPTX
Load Balancing and Scaling with NGINX
PDF
High Performance Drupal Sites
KEY
Novalug 07142012
PDF
Qcon 090408233824-phpapp01
PDF
Facebook architecture
PDF
Facebook的架构
PDF
Facebook architecture
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
Drupal High Availability High Performance 2012
Develop and deploy using Hybrid Cloud Strategies confoo2012
Wordpress Meetup ISCTE
Nginx pres
Why You Should Choose a Software-Based Load Balancer
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
Case Study with Answers.com on Scaling with Memcached and MySQL
Designing enterprise drupal
PHP in the Cloud
Caching and tuning fun for high scalability
Load Balancing and Scaling with NGINX
High Performance Drupal Sites
Novalug 07142012
Qcon 090408233824-phpapp01
Facebook architecture
Facebook的架构
Facebook architecture
Ad

More from Daniel Londero (10)

PDF
Magento meets vagrant
PDF
Random Tips for Remote Working
PDF
REST in practice with Symfony2
PDF
Rest in practice con Symfony2
PDF
Lavorare da casa: siamo pronti?
PDF
Symfony2, SQL e NoSQL. Assieme. Si può.
PDF
Lavorare da casa: siamo pronti?
ODP
Io cache, tu database
ODP
Unit testing 101
ODP
Enterprise Open Source: Il caso PHP
Magento meets vagrant
Random Tips for Remote Working
REST in practice with Symfony2
Rest in practice con Symfony2
Lavorare da casa: siamo pronti?
Symfony2, SQL e NoSQL. Assieme. Si può.
Lavorare da casa: siamo pronti?
Io cache, tu database
Unit testing 101
Enterprise Open Source: Il caso PHP

Recently uploaded (20)

PPTX
MuleSoft-Compete-Deck for midddleware integrations
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PPTX
Training Program for knowledge in solar cell and solar industry
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PPTX
Configure Apache Mutual Authentication
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPTX
Internet of Everything -Basic concepts details
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
MuleSoft-Compete-Deck for midddleware integrations
giants, standing on the shoulders of - by Daniel Stenberg
Training Program for knowledge in solar cell and solar industry
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
NewMind AI Weekly Chronicles – August ’25 Week IV
Configure Apache Mutual Authentication
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
sbt 2.0: go big (Scala Days 2025 edition)
Custom Battery Pack Design Considerations for Performance and Safety
Taming the Chaos: How to Turn Unstructured Data into Decisions
Internet of Everything -Basic concepts details
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Data Virtualization in Action: Scaling APIs and Apps with FME
Enhancing plagiarism detection using data pre-processing and machine learning...
Lung cancer patients survival prediction using outlier detection and optimize...
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
Rapid Prototyping: A lecture on prototyping techniques for interface design

Symfony e grandi numeri: si può fare!