SlideShare a Scribd company logo
1 of 40
Download to read offline
Scalarea Aplicatiilor Web
       Andrei Gheorghe
          idevelop.ro
Cazul cel mai comun

    Shared Hosting
Unde apar probleme
• Puterea de procesare a serverului:
  CPU, RAM, etc
• Latimea de banda
• Capacitate de stocare
• Baza de date
Server Web + Server DB
Load Balancing
Load Balancing
• Hardware
  • Balancingul se face la nivel de transport pachete
  • Scump, nu stie nimic despre arhitectura aplicatiei

• DNS Load Distribution (quot;Round Robinquot;)
  •   Statistic, distribuie traficul uniform
  •   Nu stie nimic despre disponibilitatea serverelor
  •   Pot aparea probleme de DNS caching
  •   Este o solutie doar la scara foarte mare

• Reverse Proxy
Reverse Proxy Load Balancing
•   Un singur front-end pentru mai multe servere
•   Securitate
•   Accelerarea cererilor SSL
•   Caching

• nginx, squid, lighthttpd
Relational Databases
    tabele, coloane, joinuri
MySQL Replication
MySQL Cluster
• Data node
   – Nu se interactioneaza direct cu ele
• Management node
   – Configurarea si monitorizarea clusterului
• SQL node (mysqld process):
   – Un server MySQL care se conecteaza la nodurile de date
     pentru a cere sau stoca informatii

• Generally, each node will run on a separate host
MySQL Cluster
• Synchronous Replication
  – Datele sunt replicate pe mai multe noduri pentru a asigura
    disponibilitatea in cazul deconectarii unui nod de date
• Horizontal Data Partitioning
  – Informatiile sunt partitionate automat intre toate nodurile de
    date folosind un algoritm bazat pe primary key
• Hybrid Storage
  – memory / disk
• Shared Nothing
  – “no single point of failure“
Normalizare
• Presupune aducerea bazei de date la o
  “forma normala”
• Datele sunt structurate pe tabele cu relatii
  intre ele, si fiecare informatie apare o
  singura data
• Asigura consistenta informatiei in cazul
  operatiilor asupra bazei de date
Normalizare / Denormalizare

USERS
user_id, user_name, user_password

POSTS
post_id, post_author_id

COMMENTS
c_id, c_post_id, c_text
Normalizare / Denormalizare

USERS
user_id, user_name, user_password

POSTS
post_id, post_author_id, post_author_name

COMMENTS
c_id, c_post_id, c_text
Normalizare / Denormalizare

USERS
user_id, user_name, user_password

POSTS
post_id, post_author_id, post_author_name,
post_comment_count

COMMENTS
c_id, c_post_id, c_text
Key → Value Databases
Key → Value Databases
• Distributed, persistent hash tables
  • quot;Eventual consistencyquot;

• Permit SELECT-uri cu conditii
• Necesita o doza de denormalizare a datelor
  • Tratarea manuala a inconsistentelor, propagarea datelor
    corecte


• MemcacheDB, CouchDB, Amazon SimpleDB, Hypertable,
  Google BigTable
Sharding
Vertical Sharding
• Un server pentru useri, un server pentru
  search, etc
• JOIN-urile intre tabele se fac manual
  • Denormalizarea DB reduce nevoia de JOIN-uri



                                       SEARCH
                      COMMENTS
       USERS
Horizontal Sharding
• Impartirea inregistrarilor dintr-un tabel intre
  mai multe servere
• Algoritmul de impartire este foarte important
  • in functie de algoritmul ales, reechilibrarea
    datelor in cazul modificarii topologiei         USR #1
    poate fi dificila

• Se poate folosi un dictionar central              USR #2

  • algoritm transparent
  • mai usor de reechilibrat                        USR #3

  • poate crea SPF
Avantajele sharding-ului
• High availability.
  • Daca un server crapa, aplicatia continua sa functioneze

• Query-uri mai rapide
  • Query-urile fiind pe bucati mai mici de date se executa
    mai repede

• Rata de scriere mai mare
  • Scrierile se executa mai repede deoarece, neavand un
    server central, se executa in paralel
Cache
memcached
 memcached -d -u www -m 2048 -l 10.0.0.8 -p 11211

• Hash table distribuit, pastrat in RAM
     set(key, value)
     get(key)
     delete(key)

• value este de obicei un intreg obiect serializat
   • Ex: articol + comentarii + informatii autor

• Exista clase de interactiune cu memcached pentru orice
  limbaj de programare, inclusiv PHP
memcached
• quot;Least Recently Usedquot;

• Intr-o retea cu mai multe servere, instantele
  de memcached pot fi legate intre ele pentru a
  forma un cluster memcache in care cache-ul
  este replicat pe mai multe noduri

• memcached ruleaza pe Linux, Windows,
  poate fi pornit oriunde exista RAM liber
Session Clustering
Load Balancing Revisited
Session Clustering
• Store in common filesystem
  • Not useful in multi-server environments
  • NFS will cache pages

• Store in database
  • Very fast because you are only ever looking up primary keys
  • Make sure the DB has row locking (InnoDB), not table locking.


• Store in memcached
  • Stored across several machines rather than just one.
  • A total machine failure now affects only a percentage of users
    rather than everyone.
Content Delivery Network
• A collection of web servers distributed across
  multiple locations to deliver static content more
  efficiently to users.
• The server selected for delivering content to a
  specific user is typically based on a measure of
  network proximity.
Multiple Codebases
• Daca arhitectura serverelor si a site-ului o
  permite, se pot face lucruri interesante avand
  cod diferit
• Folosind un reverse proxy, se pot trimite 10%
  din vizitatori spre o versiune 2.0 beta a site-ului
  si observa felul cum interactioneaza
• Daca lucrurile nu ies cum ar trebui, se revine la
  codul initial si nu au fost afectati decat 10%
Studii de caz
 highscalability.com
LAMP
   Shards
 Memcached
    Squid
   Smarty
Imagemagick
• More than 4 billion queries per day
• ~35M photos in squid cache (total)
• ~2M photos in squid’s RAM
• ~470M photos, 4 or 5 sizes of each
• 38k req/sec to memcached (12M objects)
• 2 PB raw storage (consumed about ~1.5TB on
  Sunday
• Over 400,000 photos being added every day
• Debian Linux, Apache, PHP, MySQL
• memcached
• MemcacheDB - distributed key-value storage
  system which conforms to memcache protocol
  →15,000 writes/second, 64,000 reads/second
• Lots of servers
• 26 million uniques a month
• 30 million users.
• Uniques are only half that traffic. Traffic =
  unique web visitors + APIs + Digg buttons.
• 2 billion requests a month
• 13,000 requests a second, peak at 27,000
  requests a second.
• Data are separated into separate clusters: User
  Actions, Users, Comments, Items, etc.
• Asynchronous queuing architecture for near-
  term processing
Amazon Web Services
Simple Storage Service (S3)
•   Cloud storage service
•   Servere in US / Europe
•   REST API
•   Stocare: $0.150 / GB
•   Upload: $0.100 / GB
•   Download: $0.170 / GB

• Twitter foloseste S3 pentru pozele userilor
Elastic Compute Cloud (EC2)
• On-demand server instances
• In 5 minute poti porni un server la care ai acces
  root
• $0.10 / ora, 99.95% uptime garantat
  – 4 ore pe an downtime
• Se pot aloca adrese IP statice si se pot construi
  arhitecturi complexe
• Acces rapid la S3
SimpleDB
• Distributed hash DB
• Permite SELECT-uri cu conditii
• Query limitat la 5 secunde
thank you, come again

More Related Content

What's hot

MongoDB and server performance
MongoDB and server performanceMongoDB and server performance
MongoDB and server performanceAlon Horev
 
Introduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESBIntroduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESBAdroitLogic
 
How to monitor MongoDB
How to monitor MongoDBHow to monitor MongoDB
How to monitor MongoDBServer Density
 
LibX 2.0
LibX 2.0LibX 2.0
LibX 2.0eby
 
Using memcache to improve php performance
Using memcache to improve php performanceUsing memcache to improve php performance
Using memcache to improve php performanceSudar Muthu
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 cachingShih-yi Wei
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference RecapChris Barber
 
Shared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice PellandShared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice PellandFuenteovejuna
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisationgrooverdan
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101ConFoo
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB
 
Warsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective StreamingWarsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective StreamingPatryk Bandurski
 
Memcached And MySQL
Memcached And MySQLMemcached And MySQL
Memcached And MySQLChris Barber
 
Engage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionEngage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionWebtrends
 

What's hot (20)

MongoDB and server performance
MongoDB and server performanceMongoDB and server performance
MongoDB and server performance
 
Introduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESBIntroduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESB
 
How to monitor MongoDB
How to monitor MongoDBHow to monitor MongoDB
How to monitor MongoDB
 
7 Ways To Crash Postgres
7 Ways To Crash Postgres7 Ways To Crash Postgres
7 Ways To Crash Postgres
 
GUC Tutorial Package (9.0)
GUC Tutorial Package (9.0)GUC Tutorial Package (9.0)
GUC Tutorial Package (9.0)
 
LibX 2.0
LibX 2.0LibX 2.0
LibX 2.0
 
Using memcache to improve php performance
Using memcache to improve php performanceUsing memcache to improve php performance
Using memcache to improve php performance
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 caching
 
Memcache
MemcacheMemcache
Memcache
 
Shootout at the AWS Corral
Shootout at the AWS CorralShootout at the AWS Corral
Shootout at the AWS Corral
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference Recap
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
Shared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice PellandShared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisation
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management Demystified
 
Warsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective StreamingWarsaw MuleSoft Meetup #12 Effective Streaming
Warsaw MuleSoft Meetup #12 Effective Streaming
 
Memcached And MySQL
Memcached And MySQLMemcached And MySQL
Memcached And MySQL
 
Engage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data CollectionEngage 2013 - Multi Channel Data Collection
Engage 2013 - Multi Channel Data Collection
 

Viewers also liked

Viewers also liked (8)

Commentary
CommentaryCommentary
Commentary
 
Cake and coffee: Exam outline
Cake and coffee: Exam outlineCake and coffee: Exam outline
Cake and coffee: Exam outline
 
WieczóR Wspomnien
WieczóR WspomnienWieczóR Wspomnien
WieczóR Wspomnien
 
Jones natural chews ~ usa natural dog chews ~ animal brands 2015
Jones natural chews ~ usa natural dog chews ~ animal brands 2015Jones natural chews ~ usa natural dog chews ~ animal brands 2015
Jones natural chews ~ usa natural dog chews ~ animal brands 2015
 
Issue 2
Issue 2Issue 2
Issue 2
 
Social Media in the Public Service
Social Media in the Public ServiceSocial Media in the Public Service
Social Media in the Public Service
 
Epiphany Action Plan
Epiphany Action PlanEpiphany Action Plan
Epiphany Action Plan
 
Social Media for Governments and Public Service Providers
Social Media for Governments and Public Service Providers Social Media for Governments and Public Service Providers
Social Media for Governments and Public Service Providers
 

Similar to Scalarea Aplicatiilor Web - 2009

My S Q L Replication Getting The Most From Slaves
My S Q L  Replication  Getting  The  Most  From  SlavesMy S Q L  Replication  Getting  The  Most  From  Slaves
My S Q L Replication Getting The Most From SlavesPerconaPerformance
 
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedPGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedEqunix Business Solutions
 
Data storage solutions for sns game
Data storage solutions for sns gameData storage solutions for sns game
Data storage solutions for sns gameSon Aris
 
Data Storage Solutions for SNS game
Data Storage Solutions for SNS gameData Storage Solutions for SNS game
Data Storage Solutions for SNS gamewe20
 
[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practicejavablend
 
Evergreen Sysadmin Survival Skills
Evergreen Sysadmin Survival SkillsEvergreen Sysadmin Survival Skills
Evergreen Sysadmin Survival SkillsEvergreen ILS
 
Right-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual MachineRight-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual Machineheraflux
 
Messaging With ActiveMQ
Messaging With ActiveMQMessaging With ActiveMQ
Messaging With ActiveMQBruce Snyder
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Clusterguestd34230
 
Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01Jagadeesha DG
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015Ivan Glushkov
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deploymentAbhishek Singh
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Moleoscon2007
 
Storage Systems for High Scalable Systems Presentation
Storage Systems for High Scalable Systems PresentationStorage Systems for High Scalable Systems Presentation
Storage Systems for High Scalable Systems Presentationandyman3000
 

Similar to Scalarea Aplicatiilor Web - 2009 (20)

Qcon
QconQcon
Qcon
 
My S Q L Replication Getting The Most From Slaves
My S Q L  Replication  Getting  The  Most  From  SlavesMy S Q L  Replication  Getting  The  Most  From  Slaves
My S Q L Replication Getting The Most From Slaves
 
MySQL Tuning
MySQL TuningMySQL Tuning
MySQL Tuning
 
Advanced Deployment
Advanced DeploymentAdvanced Deployment
Advanced Deployment
 
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedPGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
 
Data storage solutions for sns game
Data storage solutions for sns gameData storage solutions for sns game
Data storage solutions for sns game
 
Data Storage Solutions for SNS game
Data Storage Solutions for SNS gameData Storage Solutions for SNS game
Data Storage Solutions for SNS game
 
[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice
 
Evergreen Sysadmin Survival Skills
Evergreen Sysadmin Survival SkillsEvergreen Sysadmin Survival Skills
Evergreen Sysadmin Survival Skills
 
Right-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual MachineRight-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual Machine
 
Mysql Optimization
Mysql OptimizationMysql Optimization
Mysql Optimization
 
Messaging With ActiveMQ
Messaging With ActiveMQMessaging With ActiveMQ
Messaging With ActiveMQ
 
20080611accel
20080611accel20080611accel
20080611accel
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Cluster
 
Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01Newsql 2015-150213024325-conversion-gate01
Newsql 2015-150213024325-conversion-gate01
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deployment
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Mole
 
Storage Systems for High Scalable Systems Presentation
Storage Systems for High Scalable Systems PresentationStorage Systems for High Scalable Systems Presentation
Storage Systems for High Scalable Systems Presentation
 
Practical MySQL
Practical MySQLPractical MySQL
Practical MySQL
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

Scalarea Aplicatiilor Web - 2009

  • 1. Scalarea Aplicatiilor Web Andrei Gheorghe idevelop.ro
  • 2. Cazul cel mai comun Shared Hosting
  • 3. Unde apar probleme • Puterea de procesare a serverului: CPU, RAM, etc • Latimea de banda • Capacitate de stocare • Baza de date
  • 4. Server Web + Server DB
  • 6. Load Balancing • Hardware • Balancingul se face la nivel de transport pachete • Scump, nu stie nimic despre arhitectura aplicatiei • DNS Load Distribution (quot;Round Robinquot;) • Statistic, distribuie traficul uniform • Nu stie nimic despre disponibilitatea serverelor • Pot aparea probleme de DNS caching • Este o solutie doar la scara foarte mare • Reverse Proxy
  • 7. Reverse Proxy Load Balancing • Un singur front-end pentru mai multe servere • Securitate • Accelerarea cererilor SSL • Caching • nginx, squid, lighthttpd
  • 8. Relational Databases tabele, coloane, joinuri
  • 10. MySQL Cluster • Data node – Nu se interactioneaza direct cu ele • Management node – Configurarea si monitorizarea clusterului • SQL node (mysqld process): – Un server MySQL care se conecteaza la nodurile de date pentru a cere sau stoca informatii • Generally, each node will run on a separate host
  • 11. MySQL Cluster • Synchronous Replication – Datele sunt replicate pe mai multe noduri pentru a asigura disponibilitatea in cazul deconectarii unui nod de date • Horizontal Data Partitioning – Informatiile sunt partitionate automat intre toate nodurile de date folosind un algoritm bazat pe primary key • Hybrid Storage – memory / disk • Shared Nothing – “no single point of failure“
  • 12. Normalizare • Presupune aducerea bazei de date la o “forma normala” • Datele sunt structurate pe tabele cu relatii intre ele, si fiecare informatie apare o singura data • Asigura consistenta informatiei in cazul operatiilor asupra bazei de date
  • 13. Normalizare / Denormalizare USERS user_id, user_name, user_password POSTS post_id, post_author_id COMMENTS c_id, c_post_id, c_text
  • 14. Normalizare / Denormalizare USERS user_id, user_name, user_password POSTS post_id, post_author_id, post_author_name COMMENTS c_id, c_post_id, c_text
  • 15. Normalizare / Denormalizare USERS user_id, user_name, user_password POSTS post_id, post_author_id, post_author_name, post_comment_count COMMENTS c_id, c_post_id, c_text
  • 16. Key → Value Databases
  • 17. Key → Value Databases • Distributed, persistent hash tables • quot;Eventual consistencyquot; • Permit SELECT-uri cu conditii • Necesita o doza de denormalizare a datelor • Tratarea manuala a inconsistentelor, propagarea datelor corecte • MemcacheDB, CouchDB, Amazon SimpleDB, Hypertable, Google BigTable
  • 19. Vertical Sharding • Un server pentru useri, un server pentru search, etc • JOIN-urile intre tabele se fac manual • Denormalizarea DB reduce nevoia de JOIN-uri SEARCH COMMENTS USERS
  • 20. Horizontal Sharding • Impartirea inregistrarilor dintr-un tabel intre mai multe servere • Algoritmul de impartire este foarte important • in functie de algoritmul ales, reechilibrarea datelor in cazul modificarii topologiei USR #1 poate fi dificila • Se poate folosi un dictionar central USR #2 • algoritm transparent • mai usor de reechilibrat USR #3 • poate crea SPF
  • 21. Avantajele sharding-ului • High availability. • Daca un server crapa, aplicatia continua sa functioneze • Query-uri mai rapide • Query-urile fiind pe bucati mai mici de date se executa mai repede • Rata de scriere mai mare • Scrierile se executa mai repede deoarece, neavand un server central, se executa in paralel
  • 22. Cache
  • 23. memcached memcached -d -u www -m 2048 -l 10.0.0.8 -p 11211 • Hash table distribuit, pastrat in RAM set(key, value) get(key) delete(key) • value este de obicei un intreg obiect serializat • Ex: articol + comentarii + informatii autor • Exista clase de interactiune cu memcached pentru orice limbaj de programare, inclusiv PHP
  • 24. memcached • quot;Least Recently Usedquot; • Intr-o retea cu mai multe servere, instantele de memcached pot fi legate intre ele pentru a forma un cluster memcache in care cache-ul este replicat pe mai multe noduri • memcached ruleaza pe Linux, Windows, poate fi pornit oriunde exista RAM liber
  • 27. Session Clustering • Store in common filesystem • Not useful in multi-server environments • NFS will cache pages • Store in database • Very fast because you are only ever looking up primary keys • Make sure the DB has row locking (InnoDB), not table locking. • Store in memcached • Stored across several machines rather than just one. • A total machine failure now affects only a percentage of users rather than everyone.
  • 28. Content Delivery Network • A collection of web servers distributed across multiple locations to deliver static content more efficiently to users. • The server selected for delivering content to a specific user is typically based on a measure of network proximity.
  • 29. Multiple Codebases • Daca arhitectura serverelor si a site-ului o permite, se pot face lucruri interesante avand cod diferit • Folosind un reverse proxy, se pot trimite 10% din vizitatori spre o versiune 2.0 beta a site-ului si observa felul cum interactioneaza • Daca lucrurile nu ies cum ar trebui, se revine la codul initial si nu au fost afectati decat 10%
  • 30. Studii de caz highscalability.com
  • 31. LAMP Shards Memcached Squid Smarty Imagemagick
  • 32. • More than 4 billion queries per day • ~35M photos in squid cache (total) • ~2M photos in squid’s RAM • ~470M photos, 4 or 5 sizes of each • 38k req/sec to memcached (12M objects) • 2 PB raw storage (consumed about ~1.5TB on Sunday • Over 400,000 photos being added every day
  • 33. • Debian Linux, Apache, PHP, MySQL • memcached • MemcacheDB - distributed key-value storage system which conforms to memcache protocol →15,000 writes/second, 64,000 reads/second • Lots of servers
  • 34. • 26 million uniques a month • 30 million users. • Uniques are only half that traffic. Traffic = unique web visitors + APIs + Digg buttons. • 2 billion requests a month • 13,000 requests a second, peak at 27,000 requests a second.
  • 35. • Data are separated into separate clusters: User Actions, Users, Comments, Items, etc. • Asynchronous queuing architecture for near- term processing
  • 37. Simple Storage Service (S3) • Cloud storage service • Servere in US / Europe • REST API • Stocare: $0.150 / GB • Upload: $0.100 / GB • Download: $0.170 / GB • Twitter foloseste S3 pentru pozele userilor
  • 38. Elastic Compute Cloud (EC2) • On-demand server instances • In 5 minute poti porni un server la care ai acces root • $0.10 / ora, 99.95% uptime garantat – 4 ore pe an downtime • Se pot aloca adrese IP statice si se pot construi arhitecturi complexe • Acces rapid la S3
  • 39. SimpleDB • Distributed hash DB • Permite SELECT-uri cu conditii • Query limitat la 5 secunde