SlideShare uma empresa Scribd logo
1 de 28
Web scale MySQL@ facebook DomasMituzas 2011-10-03
Agenda
Facebook 800M active monthly users 500M active daily users 350M mobile users 7M apps and websites integrated via platform
Current
Setup Software MySQL 5.1 Custom facebook patch Launchpad - mysqlatfacebook Extra resiliency Reduced operations effort Hardware Variety of generations Many core Local storage Some flash storage
UDB Performance numbers (FromSep. 2011) Query response time 4ms reads, 5ms writes Network bytes sent per second 90GB peak Queries per second 60M peak Rows read per second 1450M peak Rows changed per second 3.5M peak InnoDB page IO per second 8.1M peak
Performance focus Focus on reliable throughput in production Avoid performance stalls Make sure hardware is used 99th percentile rather than average or median Worst offender analysis – topN & histograms instead of tier averages
Stalls “Dogpiles” Temporary slow down – even 0.1s is huge
Stall tools Dogpiled (in-house) Snapshot aggregation of server state at distress  “time machine” view into logs before the event too Aspersa (stalk, collect) Poor man’s profiler (.org) Later iterations – apmp, hpmp, tpmp GDB
Stalls found Tables extending – global I/O mutex held  Drop table – both SQL layer and InnoDB global mutexes held Purge contention – unnecessary dictionary lock held Binlog reads – no commits can happen if old events read Kernel mutex – O(N) and O(N^2) operations Transaction creation Lock creation/removal, deadlock detection Background page flushing not really background Many more
Efficiency Increasing utilization of hardware Memory to Disk ratio Finding bottlenecks Disk bound normally Sometimes network Application or server software chokepoints Rarely CPU/memory bandwidth Application design Biggest wins are in optimizing the workload
Disk efficiency Normally diskIOPS bound Allowing higher queue lengths Can operate at more than 8 pending operations per disk InnoDB page size Need adjustable per table or index for real gain XFS/deadline Parallelism at MySQL layer >300 iops on 166 rps disks
Memory efficiency Compact records – Thrift compaction for objects, etc Clustered and covering index planning FORCE INDEX – avoid unnecessary I/O and cached pages Historical data access costly Full table scans ETL-type queries, mysqldump, … Tune midpoint insertion LRU for InnoDB Incremental updating, incremental binary backups O_DIRECT data and logs access
Pure flash (Cheating) Data stored directly on flash Limited data size Not utilizing flash card fully Still used in some cases
Flashcache Flash in front of disks Can use slower disks Write-back cache Much more data storage Able to utilize much more of flash card Very long warmup time Open source (github/facebook/flashcache)
MySQL 2x Flash allows for large loads Large performance difference from pure disk servers  Many older servers still being used Solution? Run multiple MySQL instances per server Use ports 3307, 3308, 3309, etc… Replication prevents direct consolidation Redo a lot of port assumptions in code
Application caching Old: memcached Cache invalidation stampedes, refetching full dataset on refresh, many copies New: write-through caching Incremental cache updates Cache hierarchies for datacenter local copies Efficient operations for association set Common API for all use cases
Group commit Some OLTP workloads too busy even for modern RAID cards High I/O pressure increases response times Durability compromises increase operational overhead Dead batteries are extremely painful otherwise Now in 5.1.52-fb
Admission control Server resources are limited Per account thread concurrency Reduces O(N^2) blowup chance max_connections are no longer impacting server load Per-application resource throttling Now in 5.1.52-fb
Online Schema Change External PHP script, open source Utilizes triggers for change tracking Used on 100G+ sized tables Dump/reload + fast index creation Extendable class, may allow: PK composition changes with conflict resolution Indexing previously unindexed datasets
Tools Table and user statistics Shadows Slocket pmysql Replication sampling Client log aggregation Query comments Indigo (Query monitor)
Future
Future MySQL is never a solved problem Always investigating better/new solutions New hardware types New datacenters and topologies New use cases and clients New neighbors to share data with
Visibility Never assume Use metrics to measure When metrics aren’t available, add them Full stack More InnoDB info More application info
Replication Lag used to be a big problem, still is a bottleneck Possible solutions: “Better” slave prefetch Maatkit version has problems Our own version being used on some tiers successfully May be possible with InnoDB cooperation Continuent parallel slave Oracle parallel slave in 5.6
InnoDB Compression Originally was planned during 5.1 upgrade Problems Replication stream cost Increased log writes Performance in some cases Stability, monitoring, etc
Web scale MySQL at Facebook (Domas Mituzas)

Mais conteúdo relacionado

Mais procurados

Gavin M
Gavin MGavin M
Gavin M
Ontico
 
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
Hadoop User Group
 
Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...
Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...
Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...
Hadoop User Group
 

Mais procurados (20)

Gavin M
Gavin MGavin M
Gavin M
 
(DAT312) Using Amazon Aurora for Enterprise Workloads
(DAT312) Using Amazon Aurora for Enterprise Workloads(DAT312) Using Amazon Aurora for Enterprise Workloads
(DAT312) Using Amazon Aurora for Enterprise Workloads
 
POLARDB for MySQL - Parallel Query
POLARDB for MySQL - Parallel QueryPOLARDB for MySQL - Parallel Query
POLARDB for MySQL - Parallel Query
 
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
Yahoo! Hadoop User Group - May Meetup - Extraordinarily rapid and robust data...
 
Hdfs high availability
Hdfs high availabilityHdfs high availability
Hdfs high availability
 
Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...
Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...
Yahoo! Hadoop User Group - May Meetup - HBase and Pig: The Hadoop ecosystem a...
 
(DAT207) Amazon Aurora: The New Amazon Relational Database Engine
(DAT207) Amazon Aurora: The New Amazon Relational Database Engine(DAT207) Amazon Aurora: The New Amazon Relational Database Engine
(DAT207) Amazon Aurora: The New Amazon Relational Database Engine
 
MongoDB Capacity Planning
MongoDB Capacity PlanningMongoDB Capacity Planning
MongoDB Capacity Planning
 
Hardware Provisioning
Hardware ProvisioningHardware Provisioning
Hardware Provisioning
 
January 2011 HUG: Kafka Presentation
January 2011 HUG: Kafka PresentationJanuary 2011 HUG: Kafka Presentation
January 2011 HUG: Kafka Presentation
 
Mapping Data Flows Perf Tuning April 2021
Mapping Data Flows Perf Tuning April 2021Mapping Data Flows Perf Tuning April 2021
Mapping Data Flows Perf Tuning April 2021
 
Stream Computing (The Engineer's Perspective)
Stream Computing (The Engineer's Perspective)Stream Computing (The Engineer's Perspective)
Stream Computing (The Engineer's Perspective)
 
Webinar: Capacity Planning
Webinar: Capacity PlanningWebinar: Capacity Planning
Webinar: Capacity Planning
 
Data on azure
Data on azureData on azure
Data on azure
 
Copy data management
Copy data managementCopy data management
Copy data management
 
Spark Summit EU talk by Ahsan Javed Awan
Spark Summit EU talk by Ahsan Javed AwanSpark Summit EU talk by Ahsan Javed Awan
Spark Summit EU talk by Ahsan Javed Awan
 
Next Generation Hadoop Operations
Next Generation Hadoop OperationsNext Generation Hadoop Operations
Next Generation Hadoop Operations
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs Faster
 
Compression talk
Compression talkCompression talk
Compression talk
 
SQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should KnowSQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should Know
 

Semelhante a Web scale MySQL at Facebook (Domas Mituzas)

WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
webhostingguy
 
Drupal Backend Performance and Scalability
Drupal Backend Performance and ScalabilityDrupal Backend Performance and Scalability
Drupal Backend Performance and Scalability
Ashok Modi
 
Distributed Systems: scalability and high availability
Distributed Systems: scalability and high availabilityDistributed Systems: scalability and high availability
Distributed Systems: scalability and high availability
Renato Lucindo
 
Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginners
webhostingguy
 
02.28.13 WANdisco ApacheCon 2013
02.28.13 WANdisco ApacheCon 201302.28.13 WANdisco ApacheCon 2013
02.28.13 WANdisco ApacheCon 2013
WANdisco Plc
 
Black Friday and Cyber Monday- Best Practices for Your E-Commerce Database
Black Friday and Cyber Monday- Best Practices for Your E-Commerce DatabaseBlack Friday and Cyber Monday- Best Practices for Your E-Commerce Database
Black Friday and Cyber Monday- Best Practices for Your E-Commerce Database
Tim Vaillancourt
 

Semelhante a Web scale MySQL at Facebook (Domas Mituzas) (20)

FOWA Scaling The Lamp Stack Workshop
FOWA Scaling The Lamp Stack WorkshopFOWA Scaling The Lamp Stack Workshop
FOWA Scaling The Lamp Stack Workshop
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
 
Drupal Backend Performance and Scalability
Drupal Backend Performance and ScalabilityDrupal Backend Performance and Scalability
Drupal Backend Performance and Scalability
 
Dba tuning
Dba tuningDba tuning
Dba tuning
 
Deep Dive on Amazon Aurora
Deep Dive on Amazon AuroraDeep Dive on Amazon Aurora
Deep Dive on Amazon Aurora
 
Web Performance & Scalability Tools
Web Performance & Scalability ToolsWeb Performance & Scalability Tools
Web Performance & Scalability Tools
 
Distributed Systems: scalability and high availability
Distributed Systems: scalability and high availabilityDistributed Systems: scalability and high availability
Distributed Systems: scalability and high availability
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
UnConference for Georgia Southern Computer Science March 31, 2015
UnConference for Georgia Southern Computer Science March 31, 2015UnConference for Georgia Southern Computer Science March 31, 2015
UnConference for Georgia Southern Computer Science March 31, 2015
 
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
 
Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginners
 
11g R2
11g R211g R2
11g R2
 
Sql server 2016 it just runs faster sql bits 2017 edition
Sql server 2016 it just runs faster   sql bits 2017 editionSql server 2016 it just runs faster   sql bits 2017 edition
Sql server 2016 it just runs faster sql bits 2017 edition
 
02.28.13 WANdisco ApacheCon 2013
02.28.13 WANdisco ApacheCon 201302.28.13 WANdisco ApacheCon 2013
02.28.13 WANdisco ApacheCon 2013
 
Tales from production with postgreSQL at scale
Tales from production with postgreSQL at scaleTales from production with postgreSQL at scale
Tales from production with postgreSQL at scale
 
Performance_Up.ppt
Performance_Up.pptPerformance_Up.ppt
Performance_Up.ppt
 
Black Friday and Cyber Monday- Best Practices for Your E-Commerce Database
Black Friday and Cyber Monday- Best Practices for Your E-Commerce DatabaseBlack Friday and Cyber Monday- Best Practices for Your E-Commerce Database
Black Friday and Cyber Monday- Best Practices for Your E-Commerce Database
 
Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...
 
SharePoint 2010 Boost your farm performance!
SharePoint 2010 Boost your farm performance!SharePoint 2010 Boost your farm performance!
SharePoint 2010 Boost your farm performance!
 

Mais de Ontico

Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Ontico
 

Mais de Ontico (20)

One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
One-cloud — система управления дата-центром в Одноклассниках / Олег Анастасье...
 
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Масштабируя DNS / Артем Гавриченков (Qrator Labs)Масштабируя DNS / Артем Гавриченков (Qrator Labs)
Масштабируя DNS / Артем Гавриченков (Qrator Labs)
 
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
Создание BigData-платформы для ФГУП Почта России / Андрей Бащенко (Luxoft)
 
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
Готовим тестовое окружение, или сколько тестовых инстансов вам нужно / Алекса...
 
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
Новые технологии репликации данных в PostgreSQL / Александр Алексеев (Postgre...
 
PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)
PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)
PostgreSQL Configuration for Humans / Alvaro Hernandez (OnGres)
 
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
Inexpensive Datamasking for MySQL with ProxySQL — Data Anonymization for Deve...
 
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
Опыт разработки модуля межсетевого экранирования для MySQL / Олег Брославский...
 
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
ProxySQL Use Case Scenarios / Alkin Tezuysal (Percona)
 
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
 
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
Внутренний open-source. Как разрабатывать мобильное приложение большим количе...
 
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
Подробно о том, как Causal Consistency реализовано в MongoDB / Михаил Тюленев...
 
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
Балансировка на скорости проводов. Без ASIC, без ограничений. Решения NFWare ...
 
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
Перехват трафика — мифы и реальность / Евгений Усков (Qrator Labs)
 
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
И тогда наверняка вдруг запляшут облака! / Алексей Сушков (ПЕТЕР-СЕРВИС)
 
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
Как мы заставили Druid работать в Одноклассниках / Юрий Невиницин (OK.RU)
 
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
Разгоняем ASP.NET Core / Илья Вербицкий (WebStoating s.r.o.)
 
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...100500 способов кэширования в Oracle Database или как достичь максимальной ск...
100500 способов кэширования в Oracle Database или как достичь максимальной ск...
 
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
Apache Ignite Persistence: зачем Persistence для In-Memory, и как он работает...
 
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
Механизмы мониторинга баз данных: взгляд изнутри / Дмитрий Еманов (Firebird P...
 

Último

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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Web scale MySQL at Facebook (Domas Mituzas)

  • 1.
  • 2. Web scale MySQL@ facebook DomasMituzas 2011-10-03
  • 4. Facebook 800M active monthly users 500M active daily users 350M mobile users 7M apps and websites integrated via platform
  • 6. Setup Software MySQL 5.1 Custom facebook patch Launchpad - mysqlatfacebook Extra resiliency Reduced operations effort Hardware Variety of generations Many core Local storage Some flash storage
  • 7. UDB Performance numbers (FromSep. 2011) Query response time 4ms reads, 5ms writes Network bytes sent per second 90GB peak Queries per second 60M peak Rows read per second 1450M peak Rows changed per second 3.5M peak InnoDB page IO per second 8.1M peak
  • 8. Performance focus Focus on reliable throughput in production Avoid performance stalls Make sure hardware is used 99th percentile rather than average or median Worst offender analysis – topN & histograms instead of tier averages
  • 9. Stalls “Dogpiles” Temporary slow down – even 0.1s is huge
  • 10. Stall tools Dogpiled (in-house) Snapshot aggregation of server state at distress “time machine” view into logs before the event too Aspersa (stalk, collect) Poor man’s profiler (.org) Later iterations – apmp, hpmp, tpmp GDB
  • 11. Stalls found Tables extending – global I/O mutex held Drop table – both SQL layer and InnoDB global mutexes held Purge contention – unnecessary dictionary lock held Binlog reads – no commits can happen if old events read Kernel mutex – O(N) and O(N^2) operations Transaction creation Lock creation/removal, deadlock detection Background page flushing not really background Many more
  • 12. Efficiency Increasing utilization of hardware Memory to Disk ratio Finding bottlenecks Disk bound normally Sometimes network Application or server software chokepoints Rarely CPU/memory bandwidth Application design Biggest wins are in optimizing the workload
  • 13. Disk efficiency Normally diskIOPS bound Allowing higher queue lengths Can operate at more than 8 pending operations per disk InnoDB page size Need adjustable per table or index for real gain XFS/deadline Parallelism at MySQL layer >300 iops on 166 rps disks
  • 14. Memory efficiency Compact records – Thrift compaction for objects, etc Clustered and covering index planning FORCE INDEX – avoid unnecessary I/O and cached pages Historical data access costly Full table scans ETL-type queries, mysqldump, … Tune midpoint insertion LRU for InnoDB Incremental updating, incremental binary backups O_DIRECT data and logs access
  • 15. Pure flash (Cheating) Data stored directly on flash Limited data size Not utilizing flash card fully Still used in some cases
  • 16. Flashcache Flash in front of disks Can use slower disks Write-back cache Much more data storage Able to utilize much more of flash card Very long warmup time Open source (github/facebook/flashcache)
  • 17. MySQL 2x Flash allows for large loads Large performance difference from pure disk servers Many older servers still being used Solution? Run multiple MySQL instances per server Use ports 3307, 3308, 3309, etc… Replication prevents direct consolidation Redo a lot of port assumptions in code
  • 18. Application caching Old: memcached Cache invalidation stampedes, refetching full dataset on refresh, many copies New: write-through caching Incremental cache updates Cache hierarchies for datacenter local copies Efficient operations for association set Common API for all use cases
  • 19. Group commit Some OLTP workloads too busy even for modern RAID cards High I/O pressure increases response times Durability compromises increase operational overhead Dead batteries are extremely painful otherwise Now in 5.1.52-fb
  • 20. Admission control Server resources are limited Per account thread concurrency Reduces O(N^2) blowup chance max_connections are no longer impacting server load Per-application resource throttling Now in 5.1.52-fb
  • 21. Online Schema Change External PHP script, open source Utilizes triggers for change tracking Used on 100G+ sized tables Dump/reload + fast index creation Extendable class, may allow: PK composition changes with conflict resolution Indexing previously unindexed datasets
  • 22. Tools Table and user statistics Shadows Slocket pmysql Replication sampling Client log aggregation Query comments Indigo (Query monitor)
  • 24. Future MySQL is never a solved problem Always investigating better/new solutions New hardware types New datacenters and topologies New use cases and clients New neighbors to share data with
  • 25. Visibility Never assume Use metrics to measure When metrics aren’t available, add them Full stack More InnoDB info More application info
  • 26. Replication Lag used to be a big problem, still is a bottleneck Possible solutions: “Better” slave prefetch Maatkit version has problems Our own version being used on some tiers successfully May be possible with InnoDB cooperation Continuent parallel slave Oracle parallel slave in 5.6
  • 27. InnoDB Compression Originally was planned during 5.1 upgrade Problems Replication stream cost Increased log writes Performance in some cases Stability, monitoring, etc