Symfony e grandi numeri: si può fare!

2,247 views
2,146 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,247
On SlideShare
0
From Embeds
0
Number of Embeds
123
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Symfony e grandi numeri: si può fare!

  1. 1. Symfony e grandi numeriSi...può...fare!Daniel Londerodaniel.londero@sth.it
  2. 2. Chi sonoDaniel Londero➢ Sviluppatore PHP dal 2005 @➢ (s|S)ymfony framework➢ PUG Friuli➢ Runner
  3. 3. 2M 500k5M 300k 10k 10M200k 50k 100k
  4. 4. 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)
  5. 5. I numeri UTENTI UNICI PAGINE VISTE AL MESE AL MESEAGOSTO 2010 3,6M 36MGENNAIO 2011 3,3M 32MMARZO 2011 2,2M 28M
  6. 6. Perchè symfony?➢ Opensource➢ Community➢ Documentato➢ Test➢ Best practice (MVC / DRY / KISS / ...)
  7. 7. #GAC
  8. 8. APPLICATION LOAD BALANCERMEMCACHED MEMCACHED BE NGINX 1 NGINX N NGINX 1 NGINX N PHP FCGI PHP FCGI APC APC DATA LOAD BALANCER NFSMASTER SLAVE ... SLAVE DB DB1 DBN
  9. 9. LOAD BALANCERMEMCACHED MEMCACHED BE NGINX 1 NGINX N NGINX 1 NGINX N PHP FCGI PHP FCGI APC APC LOAD BALANCER NFSMASTER SLAVE ... SLAVE DB DB1 DBN
  10. 10. Scalare: orizzontale vs verticaleOrizzontale➢ Aggiungo macchine➢ Aumenta complessità➢ Costi e rischi più bassiVerticale➢ Aggiungo risorse➢ Bassa complessità➢ Costi e rischi elevati
  11. 11. Gestione delle sessioni➢ Balancer persistenti➢ NFS (sconsigliato)➢ Database➢ Memcached (Redis dalla 2.4)
  12. 12. LOAD BALANCERMEMCACHED MEMCACHED BE NGINX 1 NGINX N NGINX 1 NGINX N PHP FCGI PHP FCGI APC APC LOAD BALANCER NFSMASTER SLAVE ... SLAVE DB DB1 DBN
  13. 13. Cache storage system➢ SfFileCache (default)➢ SfAPCCache➢ SfEAcceleratorCache➢ SfMemcacheCache➢ SfSQLiteCache➢ sfXCacheCache
  14. 14. “There are only two hard things in ComputerScience: cache invalidation and naming things” - Phil Karlton
  15. 15. Cache pagina
  16. 16. Cache Partial e Component
  17. 17. ContatoriSfruttare la velocità di accesso alla memoria persollevare i database da operazioni inutili.➢ Impression sui banner➢ Letture articoli➢ Voti per i sondaggi
  18. 18. LOAD BALANCERMEMCACHED MEMCACHED BE NGINX 1 NGINX N NGINX 1 NGINX N PHP FCGI PHP FCGI APC APC LOAD BALANCER NFSMASTER SLAVE ... SLAVE DB DB1 DBN
  19. 19. LOAD BALANCERMEMCACHED MEMCACHED BE NGINX 1 NGINX N NGINX 1 NGINX N PHP FCGI PHP FCGI APC APC LOAD BALANCER NFSMASTER SLAVE ... SLAVE DB DB1 DBN
  20. 20. sfMasterSlavePluginall: 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
  21. 21. Strumenti utili➢ Web debug toolbar➢ Slow query log➢ Explain➢ Live on stage (and dev)
  22. 22. LOAD BALANCERMEMCACHED MEMCACHED BE NGINX 1 NGINX N NGINX 1 NGINX N PHP FCGI PHP FCGI APC APC LOAD BALANCER NFSMASTER SLAVE ... SLAVE DB DB1 DBN
  23. 23. LOAD BALANCERMEMCACHED MEMCACHED BE NGINX 1 NGINX N NGINX 1 NGINX N PHP FCGI PHP FCGI APC APC LOAD BALANCER NFSMASTER SLAVE ... SLAVE DB DB1 DBN
  24. 24. Credits e linkhttp://www.flickr.com/photos/theplanetdotcom/4879419788http://www.php.net/manual/en/book.memcache.phphttp://www.symfony-project.org/reference/1_4/en/05-Factorieshttp://www.symfony-project.org/gentle-introduction/1_4/en/12-Cachinghttp://www.symfony-project.org/jobeet/1_4/Doctrine/en/21http://www.symfony-project.org/plugins/sfDoctrineMasterSlavePluginhttp://dev.mysql.com/doc/refman/5.6/en/slow-query-log.htmlhttp://dev.mysql.com/doc/refman/5.6/en/explain.html
  25. 25. Grazie. Attendo feedback... Votate questo talk http://joind.in/3024 Contattatemidaniel.londero@sth.it | @dlondero | phpblog.it

×