SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
Scalable architecture




                By Adam Brodziak
                Global Sports Media b.v.
Abstract

   Adam Brodziak


An overview of modern web-based application
architecture - from hardware infrastructure,
through PHP/SQL code, HTML/CSS markup
distribution. All of this spiced up by cache,
loadbalancing and CDN.
Who is this guy?

   Lead developer at Global Sports Media
       GSM collects and process sports data
       GSM owns soccerway.com portal
   Linux user
   Interested in frameworks, design patterns
   Semantic Web enthousiast
   Football (soccer) fan
Topics

   The Challenge
   Infrastructure
   Code
   Cache
   CDN
Topics

   The Challenge
   Infrastructure
   Code
   Cache
   CDN
Raw numbers

   7 millions visits / month
   52 millions pageviews / month
   1 billion request / month
   6TB of traffic / month
   300k users at peak time
   Quite a few clients using the same hardware
Not so much, but...

                     700 leagues
                     Livescores
                     Game events
                     Match statistics
                     Rankings
                     Editorials
Traffic growth
The Challenge

   Loads of data to process
       Scores
       Events
       Stats
   In real-time (livescores)
   Growing number of visitors
   13K hits/sec at peak-time
10 servers to run it all
Topics

   The Challenge
   Infrastructure
   Code
   Cache
   CDN
It starts with one
Load balancing
Loadbalancing caveats

   Don't relay on the local filesystem
       Temporary files, session, logs
   Avoid assuming exclusive/single cache
       APC, Zend Cache
   Use distributed session storage
       Memcache, database
   Encalsulate above
Separate database server
DB replication
Replicaton caveats

   Writes only on master
   Reads from slaves
   Data consistency
   Replication lag
       Don't do
$master->query('UPDATE session SET logged = 1');
$slave->query('SELECT logged FROM session');
Whole image
Topics

   The Challenge
   Infrastructure
   Code
   Cache
   CDN
PHP is slow!

   Yes, but it does not matter!
   Database access is slower
   Cache over network is slower
   Disk access is slower
   HTTP requests are slower
   Webservice calls are slower
   Discover bottlenecks before blaming PHP
It's about architecture

   Heavy tasks in background
       CRON, Gearman
   Pregenerate stuff
   Move some code to SQL
       Calculations in queries
       Stored procedures
       Triggers
   C/C++ or Java for heavy computation
   Use PHP to glue it together
PHP Frameworks




   Hundreds of others
   Which one to choose?
Framework? Think again!

   Raw performance matters
   Support for master-slave replication
   Multiple layers of cache
   Working with accelerators (HipHop!)
   Beware of bottlenecks
       i.e. core part of framework is slow
   Designed to scale
Topics

   The Challenge
   Infrastructure
   Code
   Cache
   CDN
Cache is everywhere

   CPU: L1, L2
   Disk buffer
   Linux filesystem
   MySQL
   PHP (APC)
   Smarty
   HTTP Proxy
   Browser cache
Where to cache?
Memory is cheap

   Pre-generate stuff
   Store results in memory
       APC, memcached
   App config in memory
       APC with stat=off
   Increase RAM for MySQL
   Disk is the new tape
Memcached for the rescue!

   Dead simple
   Key-value
   Distributed storage pool
   Automatic invalidation after X sec
       No garbage collecting invoked
   Store arrays, objects, simple values
   Easy integration
Topics

   The Challenge
   Infrastructure
   Code
   Cache
   CDN
Reverse-proxy

   First line of cache
   Returns content if resource is up-to-date
   Works on HTTP level
       Can be integrated into existing infrastructure
   Can do load balancing
   In-memory cache storage
   Squid, Nginx, Varnish
Content Delivery Network

   Network of servers
   Worldwide
   Automatic loadbalancing
   Fast access (low ping time)
   Data redundancy gratis
   Ideal for static resources
       But not only
   Must-have for worldwide websites
CDN as reverse-proxy

   HTTP request / response chain
   Embraces REST architecture
   Requests are distributed
   Reduces latency
   Lowers traffic volume
   Increases availability
   i.e. Akamai Edge Suite
CDN at soccerway.com

   All of the content is served via CDN
       Images, CSS, JS
       Generated HTML
       JSON for Ajax
   90% of traffic via CDN
   Origin requests only from Europe
   Site online even if servers are down
   Can't live without ;)
Thank you for listening




             Questions?
Interested?

   Contact me:
       adam@globalsportsmedia.com
       www.goldenline.pl/adam-brodziak
       www.linkedin.com/in/adambrodziak
   We're hiring!
       Web developers
       Football / sport fans

Mais conteúdo relacionado

Mais procurados

Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
drupalcampest
 
Caching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsCaching for J2ee Enterprise Applications
Caching for J2ee Enterprise Applications
Debajani Mohanty
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
ColdFusionConference
 
wordpress-performance-presentation
wordpress-performance-presentationwordpress-performance-presentation
wordpress-performance-presentation
Arun Janarthanan
 
Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QA
Denis Dudaev
 
Optimizing Client-Side Performance
Optimizing Client-Side PerformanceOptimizing Client-Side Performance
Optimizing Client-Side Performance
andrew4web
 

Mais procurados (17)

Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparison
 
Simple server side cache for Express.js with Node.js
Simple server side cache for Express.js with Node.jsSimple server side cache for Express.js with Node.js
Simple server side cache for Express.js with Node.js
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
WiredTiger Overview
WiredTiger OverviewWiredTiger Overview
WiredTiger Overview
 
Caching for J2ee Enterprise Applications
Caching for J2ee Enterprise ApplicationsCaching for J2ee Enterprise Applications
Caching for J2ee Enterprise Applications
 
Redis vs Memcached
Redis vs MemcachedRedis vs Memcached
Redis vs Memcached
 
Caching
CachingCaching
Caching
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
 
Web performance Talk
Web performance TalkWeb performance Talk
Web performance Talk
 
wordpress-performance-presentation
wordpress-performance-presentationwordpress-performance-presentation
wordpress-performance-presentation
 
Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QA
 
Drupal 7 performance and optimization
Drupal 7 performance and optimizationDrupal 7 performance and optimization
Drupal 7 performance and optimization
 
WordCamp RVA
WordCamp RVAWordCamp RVA
WordCamp RVA
 
Azure Redis Cache
Azure Redis CacheAzure Redis Cache
Azure Redis Cache
 
A Technical Introduction to WiredTiger
A Technical Introduction to WiredTigerA Technical Introduction to WiredTiger
A Technical Introduction to WiredTiger
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web Perormance
 
Optimizing Client-Side Performance
Optimizing Client-Side PerformanceOptimizing Client-Side Performance
Optimizing Client-Side Performance
 

Destaque

Sintesis informativa 01 04 2013
Sintesis informativa 01 04 2013Sintesis informativa 01 04 2013
Sintesis informativa 01 04 2013
megaradioexpress
 

Destaque (7)

The english language can be a 'killer' at time
The english language can be a 'killer' at timeThe english language can be a 'killer' at time
The english language can be a 'killer' at time
 
Sintesis informativa 01 04 2013
Sintesis informativa 01 04 2013Sintesis informativa 01 04 2013
Sintesis informativa 01 04 2013
 
Media Funding and Sustainabilty
Media Funding and SustainabiltyMedia Funding and Sustainabilty
Media Funding and Sustainabilty
 
UNIV495
UNIV495UNIV495
UNIV495
 
VCAT Case Study re Insurance Obligations Melbourne / Victoria
VCAT Case Study re Insurance Obligations Melbourne / VictoriaVCAT Case Study re Insurance Obligations Melbourne / Victoria
VCAT Case Study re Insurance Obligations Melbourne / Victoria
 
Team1Samadhan
Team1SamadhanTeam1Samadhan
Team1Samadhan
 
DevOps @ InterOP Las Vegas - Jesse Robbins - Opscode
DevOps @ InterOP Las Vegas - Jesse Robbins - OpscodeDevOps @ InterOP Las Vegas - Jesse Robbins - Opscode
DevOps @ InterOP Las Vegas - Jesse Robbins - Opscode
 

Semelhante a Skalowalna architektura na przykładzie soccerway.com

Building scalable and reliable websites
Building scalable and reliable websitesBuilding scalable and reliable websites
Building scalable and reliable websites
Tomasz Zen Napierala
 
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
Michael Stack
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
Buu Nguyen
 
How to build CDN for your website
How to build CDN for your websiteHow to build CDN for your website
How to build CDN for your website
Martin Kulov
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Ontico
 

Semelhante a Skalowalna architektura na przykładzie soccerway.com (20)

Experience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's ViewExperience In Building Scalable Web Sites Through Infrastructure's View
Experience In Building Scalable Web Sites Through Infrastructure's View
 
Oracle UCM: Web Site Performance Tuning
Oracle UCM: Web Site Performance TuningOracle UCM: Web Site Performance Tuning
Oracle UCM: Web Site Performance Tuning
 
Building scalable and reliable websites
Building scalable and reliable websitesBuilding scalable and reliable websites
Building scalable and reliable websites
 
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
HBaseConAsia2018 Track3-7: The application of HBase in New Energy Vehicle Mon...
 
How to Scale to Millions of Users with AWS
How to Scale to Millions of Users with AWSHow to Scale to Millions of Users with AWS
How to Scale to Millions of Users with AWS
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
 
Speeding up your Drupal site
Speeding up your Drupal siteSpeeding up your Drupal site
Speeding up your Drupal site
 
How to build CDN for your website
How to build CDN for your websiteHow to build CDN for your website
How to build CDN for your website
 
Optimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp HoustonOptimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp Houston
 
Crimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent MemoryCrimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent Memory
 
Web Performance & Scalability Tools
Web Performance & Scalability ToolsWeb Performance & Scalability Tools
Web Performance & Scalability Tools
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
 
Get started With Microsoft Azure Virtual Machine
Get started With Microsoft Azure Virtual MachineGet started With Microsoft Azure Virtual Machine
Get started With Microsoft Azure Virtual Machine
 
Building Low Cost Scalable Web Applications Tools & Techniques
Building Low Cost Scalable Web Applications   Tools & TechniquesBuilding Low Cost Scalable Web Applications   Tools & Techniques
Building Low Cost Scalable Web Applications Tools & Techniques
 
Scalable Web Architecture
Scalable Web ArchitectureScalable Web Architecture
Scalable Web Architecture
 
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
 
Hadoop and Voldemort @ LinkedIn
Hadoop and Voldemort @ LinkedInHadoop and Voldemort @ LinkedIn
Hadoop and Voldemort @ LinkedIn
 
Scaling 101 test
Scaling 101 testScaling 101 test
Scaling 101 test
 
Scaling 101
Scaling 101Scaling 101
Scaling 101
 
Caching Methodology & Strategies
Caching Methodology & StrategiesCaching Methodology & Strategies
Caching Methodology & Strategies
 

Mais de Spodek 2.0

Empathy optymalizacja postgre_sql
Empathy optymalizacja postgre_sqlEmpathy optymalizacja postgre_sql
Empathy optymalizacja postgre_sql
Spodek 2.0
 

Mais de Spodek 2.0 (20)

Rentowna strona ecommerce przy 20 użytkownikach dziennie
Rentowna strona ecommerce przy 20 użytkownikach dziennieRentowna strona ecommerce przy 20 użytkownikach dziennie
Rentowna strona ecommerce przy 20 użytkownikach dziennie
 
Pozyskiwanie inwestora na przykładzie ServeCloud.pl
Pozyskiwanie inwestora na przykładzie ServeCloud.plPozyskiwanie inwestora na przykładzie ServeCloud.pl
Pozyskiwanie inwestora na przykładzie ServeCloud.pl
 
Marketingowy geniusz Lady GaGi
Marketingowy geniusz Lady GaGiMarketingowy geniusz Lady GaGi
Marketingowy geniusz Lady GaGi
 
Empathy optymalizacja postgre_sql
Empathy optymalizacja postgre_sqlEmpathy optymalizacja postgre_sql
Empathy optymalizacja postgre_sql
 
Co internet namieszał w budowaniu marki, czyli jak tworzyć fanbojów
Co internet namieszał w budowaniu marki, czyli jak tworzyć fanbojówCo internet namieszał w budowaniu marki, czyli jak tworzyć fanbojów
Co internet namieszał w budowaniu marki, czyli jak tworzyć fanbojów
 
Usability - narzędzia niskobudżetowe, z których warto i nie warto korzystać
Usability - narzędzia niskobudżetowe, z których warto i nie warto korzystaćUsability - narzędzia niskobudżetowe, z których warto i nie warto korzystać
Usability - narzędzia niskobudżetowe, z których warto i nie warto korzystać
 
Obowiązki przedsiębiorcy internetowego w zakresie ochrony danych osobowych
Obowiązki przedsiębiorcy internetowego w zakresie ochrony danych osobowychObowiązki przedsiębiorcy internetowego w zakresie ochrony danych osobowych
Obowiązki przedsiębiorcy internetowego w zakresie ochrony danych osobowych
 
NGN są na Śląsku! ...ale gdzie są nowe modele biznesowe?
NGN są na Śląsku! ...ale gdzie są nowe modele biznesowe?NGN są na Śląsku! ...ale gdzie są nowe modele biznesowe?
NGN są na Śląsku! ...ale gdzie są nowe modele biznesowe?
 
Startup School okiem uczestnika. O 3 miesiącach pracy nad Animili
Startup School okiem uczestnika. O 3 miesiącach pracy nad AnimiliStartup School okiem uczestnika. O 3 miesiącach pracy nad Animili
Startup School okiem uczestnika. O 3 miesiącach pracy nad Animili
 
AdTaily - twórz, dziel się, zarabiaj
AdTaily - twórz, dziel się, zarabiajAdTaily - twórz, dziel się, zarabiaj
AdTaily - twórz, dziel się, zarabiaj
 
[spodek 2.0] Tworzenie prototypów serwisów internetowych
[spodek 2.0] Tworzenie prototypów serwisów internetowych[spodek 2.0] Tworzenie prototypów serwisów internetowych
[spodek 2.0] Tworzenie prototypów serwisów internetowych
 
[spodek 2.0] Erlang
[spodek 2.0] Erlang[spodek 2.0] Erlang
[spodek 2.0] Erlang
 
[spodek 2.0] ligspace.pl
[spodek 2.0] ligspace.pl[spodek 2.0] ligspace.pl
[spodek 2.0] ligspace.pl
 
[spodek 2.0] Prototypowanie
[spodek 2.0] Prototypowanie[spodek 2.0] Prototypowanie
[spodek 2.0] Prototypowanie
 
[spodek 2.0] Pierwsze ząbki
[spodek 2.0] Pierwsze ząbki[spodek 2.0] Pierwsze ząbki
[spodek 2.0] Pierwsze ząbki
 
Jak Google pomaga nam dbać o jakość stron WWW?
Jak Google pomaga nam dbać o jakość stron WWW?Jak Google pomaga nam dbać o jakość stron WWW?
Jak Google pomaga nam dbać o jakość stron WWW?
 
Przeznaczenie technologii Flex i Adobe AIR
Przeznaczenie technologii Flex i Adobe AIRPrzeznaczenie technologii Flex i Adobe AIR
Przeznaczenie technologii Flex i Adobe AIR
 
Internet salonem dla fotografii mody
Internet salonem dla fotografii modyInternet salonem dla fotografii mody
Internet salonem dla fotografii mody
 
Między spamem, a ewangelizacją. Kontrowersje wokół marketingu szeptanego
Między spamem, a ewangelizacją. Kontrowersje wokół marketingu szeptanegoMiędzy spamem, a ewangelizacją. Kontrowersje wokół marketingu szeptanego
Między spamem, a ewangelizacją. Kontrowersje wokół marketingu szeptanego
 
Blogvertising.pl przed i zaraz po inwestycji
Blogvertising.pl przed i zaraz po inwestycjiBlogvertising.pl przed i zaraz po inwestycji
Blogvertising.pl przed i zaraz po inwestycji
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Skalowalna architektura na przykładzie soccerway.com

  • 1. Scalable architecture By Adam Brodziak Global Sports Media b.v.
  • 2. Abstract  Adam Brodziak An overview of modern web-based application architecture - from hardware infrastructure, through PHP/SQL code, HTML/CSS markup distribution. All of this spiced up by cache, loadbalancing and CDN.
  • 3. Who is this guy?  Lead developer at Global Sports Media  GSM collects and process sports data  GSM owns soccerway.com portal  Linux user  Interested in frameworks, design patterns  Semantic Web enthousiast  Football (soccer) fan
  • 4. Topics  The Challenge  Infrastructure  Code  Cache  CDN
  • 5. Topics  The Challenge  Infrastructure  Code  Cache  CDN
  • 6. Raw numbers  7 millions visits / month  52 millions pageviews / month  1 billion request / month  6TB of traffic / month  300k users at peak time  Quite a few clients using the same hardware
  • 7. Not so much, but...  700 leagues  Livescores  Game events  Match statistics  Rankings  Editorials
  • 9. The Challenge  Loads of data to process  Scores  Events  Stats  In real-time (livescores)  Growing number of visitors  13K hits/sec at peak-time
  • 10. 10 servers to run it all
  • 11. Topics  The Challenge  Infrastructure  Code  Cache  CDN
  • 14. Loadbalancing caveats  Don't relay on the local filesystem  Temporary files, session, logs  Avoid assuming exclusive/single cache  APC, Zend Cache  Use distributed session storage  Memcache, database  Encalsulate above
  • 17. Replicaton caveats  Writes only on master  Reads from slaves  Data consistency  Replication lag  Don't do $master->query('UPDATE session SET logged = 1'); $slave->query('SELECT logged FROM session');
  • 19. Topics  The Challenge  Infrastructure  Code  Cache  CDN
  • 20. PHP is slow!  Yes, but it does not matter!  Database access is slower  Cache over network is slower  Disk access is slower  HTTP requests are slower  Webservice calls are slower  Discover bottlenecks before blaming PHP
  • 21. It's about architecture  Heavy tasks in background  CRON, Gearman  Pregenerate stuff  Move some code to SQL  Calculations in queries  Stored procedures  Triggers  C/C++ or Java for heavy computation  Use PHP to glue it together
  • 22. PHP Frameworks  Hundreds of others  Which one to choose?
  • 23. Framework? Think again!  Raw performance matters  Support for master-slave replication  Multiple layers of cache  Working with accelerators (HipHop!)  Beware of bottlenecks  i.e. core part of framework is slow  Designed to scale
  • 24. Topics  The Challenge  Infrastructure  Code  Cache  CDN
  • 25. Cache is everywhere  CPU: L1, L2  Disk buffer  Linux filesystem  MySQL  PHP (APC)  Smarty  HTTP Proxy  Browser cache
  • 27. Memory is cheap  Pre-generate stuff  Store results in memory  APC, memcached  App config in memory  APC with stat=off  Increase RAM for MySQL  Disk is the new tape
  • 28. Memcached for the rescue!  Dead simple  Key-value  Distributed storage pool  Automatic invalidation after X sec  No garbage collecting invoked  Store arrays, objects, simple values  Easy integration
  • 29. Topics  The Challenge  Infrastructure  Code  Cache  CDN
  • 30. Reverse-proxy  First line of cache  Returns content if resource is up-to-date  Works on HTTP level  Can be integrated into existing infrastructure  Can do load balancing  In-memory cache storage  Squid, Nginx, Varnish
  • 31. Content Delivery Network  Network of servers  Worldwide  Automatic loadbalancing  Fast access (low ping time)  Data redundancy gratis  Ideal for static resources  But not only  Must-have for worldwide websites
  • 32. CDN as reverse-proxy  HTTP request / response chain  Embraces REST architecture  Requests are distributed  Reduces latency  Lowers traffic volume  Increases availability  i.e. Akamai Edge Suite
  • 33. CDN at soccerway.com  All of the content is served via CDN  Images, CSS, JS  Generated HTML  JSON for Ajax  90% of traffic via CDN  Origin requests only from Europe  Site online even if servers are down  Can't live without ;)
  • 34. Thank you for listening Questions?
  • 35. Interested?  Contact me:  adam@globalsportsmedia.com  www.goldenline.pl/adam-brodziak  www.linkedin.com/in/adambrodziak  We're hiring!  Web developers  Football / sport fans