SlideShare uma empresa Scribd logo
1 de 41
Baixar para ler offline
© King Digital Entertainment plc 2014MySQL @ KingScaling Candy CrushOlle Nilsson, Senior Database Engineer @ KingTed Wennmark, Senior Principal Sales Consultant @ Oracle
© King Digital Entertainment plc 2014 
Table of contents 
2 
Introductions 
Scaling MySQL 
Scaling Candy Crush Saga 
Q & A
© King Digital Entertainment plc 2014 
Introductions 
3 
Olle 
•Senior Database Engineer @ King 
•Previously in MySQL Consulting @ Oracle EMEA 
•Developer and Consultant @ Upsys (MySQL Pratner) 
•Often colleagues with Ted 
Ted 
•Senior Principal Sales Consultant @ Oracle EMEA 
•Developer and Consultant @ Upsys (MySQL Pratner) 
•Long time MySQL user & friend of Olle
We make great games 
4 
-More than190 funtitles played in over 200 countries around the world 
-345 million averagemonthlyuniqueusers(Q2 2014) 
-Studios in Stockholm, London, Barcelona, Bucharest, Malmo, Berlin and Singapore. Offices in San Francisco, Malta, Tokyo, Seoul and Shanghai 
About King 
© King Digital Entertainment plc 2014
© King Digital Entertainment plc 2014 5 
Some stats and factsMillions of players around the world 
•345mm MUUs as of Q2 2014 
•138mm DAUs as of Q2 2014 
•More players playing at least one of our games each month than thepopulation of the US! Games popular across platforms, and can be played anywhere, anytime on any deviceGlobal leader in cross- platform casual games 
•Three games in all three major top ten grossing lists for Q2 2014 
•Our Saga games allow players to switch platform without losing their progress 
•Four global franchises: Candy Crush Pet Rescue Farm Heroes Bubble Witch 
•Founded in 2003, studios in Stockholm, London, Barcelona, Malmo, Bucharest, Berlin and Singapore 
•900+ employees
© King Digital Entertainment plc 2014 
Some of our games 
6
“Saga” concept 
7 
Play a leveland get a score and earn1-3 stars 
Progress tothe nextlevel 
Seethe progress ofyourfriends! 
Progress is storedand accessiblecross platform/device. 
Historyand background
© King Digital Entertainment plc 2014 
Scaling MySQL 
8
© King Digital Entertainment plc 2014 
Scaling MySQL 
9 
Scale up / Vertical scaling 
•Buy more or faster disk 
•Buy more memory 
•Buy more or faster CPU’s 
Scale out / Horizontal scaling 
•Shard by function 
•Shard by columns 
•Shard by rows
© King Digital Entertainment plc 2014 
Introduction to Sharding 
10
© King Digital Entertainment plc 2014 
What is sharding? 
11 
Divide your dataset into several pieces, think of horizontal partitioning where each partition resides on dedicated instance/HW. 
Statements are spread amongst all partitions. 
Each shard can be located on separate servers.
© King Digital Entertainment plc 2014 
Why shard? 
12 
Performance 
•Smaller working set of data on each shard. Working set fits (better) in memory 
•Fetch data in parallel from many shards. 
Size 
•Database too big and will not fit on disk/memory on one server 
GEO latency 
•You want to shard on GEO and have ’local’ shards close to your users
© King Digital Entertainment plc 2014 
Getting started 
13 
Choosing shard-key and type of shard distribution 
•RANGE, HASH, etc 
•USER, TIME, etc 
Operations 
•Shard move 
•Shard split 
•Fail-over / Switch-over 
Monitoring 
•Identify quickly growing or ”Hot” shards 
Interfaces and metadata for sharding 
•DIY 
•MySQL Fabric or similar framework
© King Digital Entertainment plc 2014 
Sharding challenges 
14 
JOINs 
•Tables are spread over multiple servers 
AUTO_INCREMENTs / Sequences 
•In MySQL these are per table 
Backups 
•Coordinating over multiple servers 
Complex operations 
•Schema changes, shard splitting, sharding SW 
Complex HA 
•Stand-by servers also need to be sharded 
Management (deploy / orchestration) 
•Automation a must
© King Digital Entertainment plc 2014 
Sharding architecture 
15 
1.Lookup shard for User 100 
2.User 100 is on Shard 1 
3.Fetch data related to User 100 from shard Shard 1 
4.User data for User 100 sent from Shard 1 
sh4 
sh3 
sh2 
sh1 
META 
Sharding API 
Apps 
1 
2 
3 
4
© King Digital Entertainment plc 2014 
Sharding Frameworks 
16 
MySQL Fabric 
•Based on plain old MySQL Replication 
•Requires GTID 
•Fabric aware connectors 
•Automatic failover
© King Digital Entertainment plc 2014 
Sharding Frameworks 
17 
MySQL Cluster 
•Automatic sharding 
•Shared nothing architecture 
•No SPOF 
•IMDB 
•ndbmtd, ndb_mgm, and API nodes
© King Digital Entertainment plc 2014 
Sharding Frameworks 
18 
Gizzard (Twitter) 
DbShards 
Hibernate Shards 
ScaleBase 
Many in-house custom made solutions
© King Digital Entertainment plc 2014 
Scaling Candy Crush Saga 
19
20 
Scaling Candy Crush Saga 
Candy Crush Numbers: 
849M game plays per day 
84M Candy Crush DAU 
Served by MySQL 
As of Q2 2014 
© King Digital Entertainment plc 2014
21 
ShardingCandy Crush Saga 
Sharding architecture in place before Candy Crush explosion 
Only 4 people in Operations 
10-20 new DB servers deployed every month at peak (+ ~50 App servers + Memcached + BI) 
No dedicated DB staff 
© King Digital Entertainment plc 2014
© King Digital Entertainment plc 2014 
Architecture overview 
22
© King Digital Entertainment plc 2014 
Architecture overview 
23 
250 000requests / s 
50 000writes / s 
(60 MB/s) 
1 800 000reads / s 
250 000writes / s 
As of Q2 2014
© King Digital Entertainment plc 2014 
Regular operation 
24 
MySQL Sharding
© King Digital Entertainment plc 2014 
MySQL Numbers 
25 
User-Shards: 
•> 50TB 
•> 500K qps 
•10/1 Read/Write 
•Several billion row tables 
•100+ instances 
•MySQL 5.1 and 5.6 (5.0 and 5.5 used for inhouse applications) 
•Memcached: Roughly 2M qps 
•App servers caches in front of Memcached 
As of Q2 2014
© King Digital Entertainment plc 2014 
MySQL Numbers 
26 
•Hardware 
################################################################################ 
#### hostXXX (debian/7.4 -Linux 3.2.0-4-amd64) #### 
#### XYXXYZXYZXYZXYZ member of: SOME IMPORTANT GROUP #### 
#### ProLiant DL380p Gen8 #### 
#### Intel(R) Xeon(R) CPU E5-2695 v2 @ 2.40GHz 48x2.4 Ghz #### 
#### 379 GB #### 
################################################################################ 
SSDs in RAID10 for data 
HDDs in RAID 10 for logs
MySQL @ King 
27 
Main database technology at King 
Backs all our games 
Plenty of other applications are backed by MySQL 
•Customer support 
•Custom built BI/Analysis applications 
•Buisness Systems (Collaboration, issue tracking, etc) 
•Other internal applications, e.g., developer support utilities 
© King Digital Entertainment plc 2014
© King Digital Entertainment plc 2014 
Database tier 
28 
The butter and cream of the storage world: 
MySQL 
+ 
Memcached 
Makes everything better!
© King Digital Entertainment plc 2014 
MySQL Requirements 
29 
Mission Critical 
Critical functions break without it 
Mobile clients can playwithout connectivity. Client game state overrides on reconnect 
Sub millisecond response time expected. > 10ms generates alarm and throttling of database usage 
No bank
© King Digital Entertainment plc 2014 
Database Architecture and Setup 
30 
Game state data for all users are stored 
No pruning or purging 
State stored as JSON blob 
Sharded MySQL databases 
UID sharding key 
One central MySQL shard catalogue data
© King Digital Entertainment plc 2014 
Application load patterns 
31 
Almost exclusively Key-Value 
Friend data read on client start up. Populates Saga. 
No joins in shards 
Some JOIN and more SQL in shard catalogue 
Sharded, highly available, KV-Store, JSON (Recognize this architecture?)
© King Digital Entertainment plc 2014 
Sharding Implementation 
32 
Central store used for 
•User/Shard lookup 
•Purchases 
•Registration 
•Application management console for 
Configuring Shard/Instance mappings 
Application user configuration 
Marketing etc 
Performance monitioring 
User Shards used for game state 
Data volume main issue 
Rich toolkit for application management 
Building tools for MySQL management
© King Digital Entertainment plc 2014 
HA and Tooling 
33 
KISS 
Master/Slave pairs. No automatic failovers 
Shard catalogue has multiple slaves 
Home built tools for switching, installing, provisioning, moving shards, etc 
Cacti, VividCortex, MEM, Ganglia, Graphite 
Nagios 
Xtrabackup/mysqldump 
Percona toolkit
© King Digital Entertainment plc 2014 
Monitoring of our databases! 
34
35 
Challenges @ King 
HDD performance 
Data Volume 
HDD => SSD 100G => SSD 200G => SSD 400G 
Delivery times for new HW 
Racking 
Buy batches of pre-rackedHW 
Network capacity issues (Memcached/backups) 
Hetergenous environment 
© King Digital Entertainment plc 2014
36 
Challenges @ King 
Relations/Friendships/Joins: joins avoided 
Volume: one of our main issues 
Performace/Scalability: Working great 
Complex Operations: problematic, lots of new components needed + consolidations, standardization 
Backups: Taken lots of work. Needs more 
Monitoring: App good. DB not yet stable 
DB Connections: Typical app server issues. 10K+ connections to DB 
© King Digital Entertainment plc 2014
37 
Solutions 
Sharding. Just worked 
Throwing HWat problems 
MySQL, easy to use, well known, stable, plenty of 3rd party tools, multiple vendors, etc. 
Get more staff 
© King Digital Entertainment plc 2014
Conclusion 
38 
Pros: Scaled out with very few problems. All games on one DB tier. 
Cons: Very rawMySQL environment. No automationand tooling. Resource allocationskew. 
© King Digital Entertainment plc 2014
© King Digital Entertainment plc 2014 
Current & Future Work 
39 
Managing the environment: Fire fighting, maintenance, new features, etc 
Data Volume management: InnoDB native compression, application compression, avoiding fragmentation (current workload fragments a lot) 
Automation, tooling, and Spring Cleaning of organically grown MySQL environment 
Document & Standardize 
Resource Utlization: CPU in abundance, storage scarce 
Migrate to 5.6 (so we can migrate to 5.7?) 
Improvementsto data-model, HW, new-games/new features 
Backupsolution improvements. DR improvements. 
Consolidationof minor in-house apps 
Handling number of connections
© King Digital Entertainment plc 2014 
Q & A 
Yes! We are hiring!! 
about.king.com/jobs 
40
Thank you 
© King Digital Entertainment plc 2014 41

Mais conteúdo relacionado

Mais procurados

Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
DataStax Academy
 

Mais procurados (20)

Lessons from Migrating Oracle Databases to Amazon RDS or Amazon Aurora
Lessons from Migrating Oracle Databases to Amazon RDS or Amazon Aurora Lessons from Migrating Oracle Databases to Amazon RDS or Amazon Aurora
Lessons from Migrating Oracle Databases to Amazon RDS or Amazon Aurora
 
MySQL in the Hosted Cloud
MySQL in the Hosted CloudMySQL in the Hosted Cloud
MySQL in the Hosted Cloud
 
MySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesMySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion Queries
 
DataStax - Analytics on Apache Cassandra - Paris Tech Talks meetup
DataStax - Analytics on Apache Cassandra - Paris Tech Talks meetupDataStax - Analytics on Apache Cassandra - Paris Tech Talks meetup
DataStax - Analytics on Apache Cassandra - Paris Tech Talks meetup
 
Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...
Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...
Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...
 
SQL Server on AWS
SQL Server on AWSSQL Server on AWS
SQL Server on AWS
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon RedshiftBest Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift
 
Data Warehousing with Amazon Redshift
Data Warehousing with Amazon RedshiftData Warehousing with Amazon Redshift
Data Warehousing with Amazon Redshift
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
 
AWS Webcast - Redshift Overview and New Features
AWS Webcast - Redshift Overview and New Features AWS Webcast - Redshift Overview and New Features
AWS Webcast - Redshift Overview and New Features
 
Apache Kudu (Incubating): New Hadoop Storage for Fast Analytics on Fast Data ...
Apache Kudu (Incubating): New Hadoop Storage for Fast Analytics on Fast Data ...Apache Kudu (Incubating): New Hadoop Storage for Fast Analytics on Fast Data ...
Apache Kudu (Incubating): New Hadoop Storage for Fast Analytics on Fast Data ...
 
Getting Started with Amazon Redshift
Getting Started with Amazon RedshiftGetting Started with Amazon Redshift
Getting Started with Amazon Redshift
 
Amazon DynamoDB and Amazon DAX
Amazon DynamoDB and Amazon DAXAmazon DynamoDB and Amazon DAX
Amazon DynamoDB and Amazon DAX
 
PostgreSQL
PostgreSQL PostgreSQL
PostgreSQL
 
Amazon Web Services - Relational Database Service Meetup
Amazon Web Services - Relational Database Service MeetupAmazon Web Services - Relational Database Service Meetup
Amazon Web Services - Relational Database Service Meetup
 
Scaling Traffic from 0 to 139 Million Unique Visitors
Scaling Traffic from 0 to 139 Million Unique VisitorsScaling Traffic from 0 to 139 Million Unique Visitors
Scaling Traffic from 0 to 139 Million Unique Visitors
 
Getting Started with Amazon EC2 and Compute Services
Getting Started with Amazon EC2 and Compute ServicesGetting Started with Amazon EC2 and Compute Services
Getting Started with Amazon EC2 and Compute Services
 
Deep Dive on Amazon Redshift
Deep Dive on Amazon RedshiftDeep Dive on Amazon Redshift
Deep Dive on Amazon Redshift
 

Semelhante a MySQL@king

Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...
Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...
Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...
Citrix
 
Mark Interrante OpenStack Design Summit
Mark Interrante OpenStack Design SummitMark Interrante OpenStack Design Summit
Mark Interrante OpenStack Design Summit
Open Stack
 

Semelhante a MySQL@king (20)

Can Your Mobile Infrastructure Survive 1 Million Concurrent Users?
Can Your Mobile Infrastructure Survive 1 Million Concurrent Users?Can Your Mobile Infrastructure Survive 1 Million Concurrent Users?
Can Your Mobile Infrastructure Survive 1 Million Concurrent Users?
 
Azure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User StoreAzure + DataStax Enterprise Powers Office 365 Per User Store
Azure + DataStax Enterprise Powers Office 365 Per User Store
 
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at DatabricksLessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
 
Sql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su AzureSql Start! 2020 - SQL Server Lift & Shift su Azure
Sql Start! 2020 - SQL Server Lift & Shift su Azure
 
MySQL Enterprise Edition Overview
MySQL Enterprise Edition OverviewMySQL Enterprise Edition Overview
MySQL Enterprise Edition Overview
 
KoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#3_Bristol_FromPlanToBackupToCloud
 
2016-JAN-28 -- High Performance Production Databases on Ceph
2016-JAN-28 -- High Performance Production Databases on Ceph2016-JAN-28 -- High Performance Production Databases on Ceph
2016-JAN-28 -- High Performance Production Databases on Ceph
 
The New MariaDB Offering: MariaDB 10, MaxScale and More
The New MariaDB Offering: MariaDB 10, MaxScale and MoreThe New MariaDB Offering: MariaDB 10, MaxScale and More
The New MariaDB Offering: MariaDB 10, MaxScale and More
 
Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...
Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...
Citrix Synergy 2014 - Syn233 Building and operating a Dev Ops cloud: best pra...
 
Big data journey to the cloud 5.30.18 asher bartch
Big data journey to the cloud 5.30.18   asher bartchBig data journey to the cloud 5.30.18   asher bartch
Big data journey to the cloud 5.30.18 asher bartch
 
Mark Interrante OpenStack Design Summit
Mark Interrante OpenStack Design SummitMark Interrante OpenStack Design Summit
Mark Interrante OpenStack Design Summit
 
Citrix Synergy 2014: Going the CloudPlatform Way
Citrix Synergy 2014: Going the CloudPlatform WayCitrix Synergy 2014: Going the CloudPlatform Way
Citrix Synergy 2014: Going the CloudPlatform Way
 
CloudOpen Japan - Controlling the cost of your first cloud
CloudOpen Japan - Controlling the cost of your first cloudCloudOpen Japan - Controlling the cost of your first cloud
CloudOpen Japan - Controlling the cost of your first cloud
 
My sql cluster case study apr16
My sql cluster case study apr16My sql cluster case study apr16
My sql cluster case study apr16
 
Netherlands Tech Tour 03 - MySQL Cluster
Netherlands Tech Tour 03 -   MySQL ClusterNetherlands Tech Tour 03 -   MySQL Cluster
Netherlands Tech Tour 03 - MySQL Cluster
 
MySQL cluster 7.4
MySQL cluster 7.4 MySQL cluster 7.4
MySQL cluster 7.4
 
M|18 How Copart Switched to MariaDB and Reduced Costs During Growth
M|18 How Copart Switched to MariaDB and Reduced Costs During GrowthM|18 How Copart Switched to MariaDB and Reduced Costs During Growth
M|18 How Copart Switched to MariaDB and Reduced Costs During Growth
 
Architecting Your Own DBaaS in a Private Cloud with EM12c
Architecting Your Own DBaaS in a Private Cloud with EM12cArchitecting Your Own DBaaS in a Private Cloud with EM12c
Architecting Your Own DBaaS in a Private Cloud with EM12c
 
MySQL Enterprise Portfolio
MySQL Enterprise PortfolioMySQL Enterprise Portfolio
MySQL Enterprise Portfolio
 
Cloud nativecomputingtechnologysupportinghpc cognitiveworkflows
Cloud nativecomputingtechnologysupportinghpc cognitiveworkflowsCloud nativecomputingtechnologysupportinghpc cognitiveworkflows
Cloud nativecomputingtechnologysupportinghpc cognitiveworkflows
 

Mais de Ted Wennmark

What's new in my sql smug
What's new in my sql smugWhat's new in my sql smug
What's new in my sql smug
Ted Wennmark
 

Mais de Ted Wennmark (17)

MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0MySQL NDB Cluster 8.0
MySQL NDB Cluster 8.0
 
Upgrade to MySQL 8.0!
Upgrade to MySQL 8.0!Upgrade to MySQL 8.0!
Upgrade to MySQL 8.0!
 
MySQL Performance - Best practices
MySQL Performance - Best practices MySQL Performance - Best practices
MySQL Performance - Best practices
 
01 upgrade to my sql8
01 upgrade to my sql8 01 upgrade to my sql8
01 upgrade to my sql8
 
MySQL as a Document Store
MySQL as a Document StoreMySQL as a Document Store
MySQL as a Document Store
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
 
MySQL HA
MySQL HAMySQL HA
MySQL HA
 
MySQL Enterprise Backup apr 2016
MySQL Enterprise Backup apr 2016MySQL Enterprise Backup apr 2016
MySQL Enterprise Backup apr 2016
 
MySQL Security
MySQL SecurityMySQL Security
MySQL Security
 
MySQL 5.7 Replication News
MySQL 5.7 Replication News MySQL 5.7 Replication News
MySQL 5.7 Replication News
 
MySQL 5.6, news in 5.7 and our HA options
MySQL 5.6, news in 5.7 and our HA optionsMySQL 5.6, news in 5.7 and our HA options
MySQL 5.6, news in 5.7 and our HA options
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
MySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQLMySQL Fabric - High Availability & Automated Sharding for MySQL
MySQL Fabric - High Availability & Automated Sharding for MySQL
 
The MySQL Performance Schema & New SYS Schema
The MySQL Performance Schema & New SYS SchemaThe MySQL Performance Schema & New SYS Schema
The MySQL Performance Schema & New SYS Schema
 
MySQL Enterprise Monitor
MySQL Enterprise MonitorMySQL Enterprise Monitor
MySQL Enterprise Monitor
 
NoSQL and MySQL
NoSQL and MySQLNoSQL and MySQL
NoSQL and MySQL
 
What's new in my sql smug
What's new in my sql smugWhat's new in my sql smug
What's new in my sql smug
 

Último

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Último (20)

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 

MySQL@king

  • 1. © King Digital Entertainment plc 2014MySQL @ KingScaling Candy CrushOlle Nilsson, Senior Database Engineer @ KingTed Wennmark, Senior Principal Sales Consultant @ Oracle
  • 2. © King Digital Entertainment plc 2014 Table of contents 2 Introductions Scaling MySQL Scaling Candy Crush Saga Q & A
  • 3. © King Digital Entertainment plc 2014 Introductions 3 Olle •Senior Database Engineer @ King •Previously in MySQL Consulting @ Oracle EMEA •Developer and Consultant @ Upsys (MySQL Pratner) •Often colleagues with Ted Ted •Senior Principal Sales Consultant @ Oracle EMEA •Developer and Consultant @ Upsys (MySQL Pratner) •Long time MySQL user & friend of Olle
  • 4. We make great games 4 -More than190 funtitles played in over 200 countries around the world -345 million averagemonthlyuniqueusers(Q2 2014) -Studios in Stockholm, London, Barcelona, Bucharest, Malmo, Berlin and Singapore. Offices in San Francisco, Malta, Tokyo, Seoul and Shanghai About King © King Digital Entertainment plc 2014
  • 5. © King Digital Entertainment plc 2014 5 Some stats and factsMillions of players around the world •345mm MUUs as of Q2 2014 •138mm DAUs as of Q2 2014 •More players playing at least one of our games each month than thepopulation of the US! Games popular across platforms, and can be played anywhere, anytime on any deviceGlobal leader in cross- platform casual games •Three games in all three major top ten grossing lists for Q2 2014 •Our Saga games allow players to switch platform without losing their progress •Four global franchises: Candy Crush Pet Rescue Farm Heroes Bubble Witch •Founded in 2003, studios in Stockholm, London, Barcelona, Malmo, Bucharest, Berlin and Singapore •900+ employees
  • 6. © King Digital Entertainment plc 2014 Some of our games 6
  • 7. “Saga” concept 7 Play a leveland get a score and earn1-3 stars Progress tothe nextlevel Seethe progress ofyourfriends! Progress is storedand accessiblecross platform/device. Historyand background
  • 8. © King Digital Entertainment plc 2014 Scaling MySQL 8
  • 9. © King Digital Entertainment plc 2014 Scaling MySQL 9 Scale up / Vertical scaling •Buy more or faster disk •Buy more memory •Buy more or faster CPU’s Scale out / Horizontal scaling •Shard by function •Shard by columns •Shard by rows
  • 10. © King Digital Entertainment plc 2014 Introduction to Sharding 10
  • 11. © King Digital Entertainment plc 2014 What is sharding? 11 Divide your dataset into several pieces, think of horizontal partitioning where each partition resides on dedicated instance/HW. Statements are spread amongst all partitions. Each shard can be located on separate servers.
  • 12. © King Digital Entertainment plc 2014 Why shard? 12 Performance •Smaller working set of data on each shard. Working set fits (better) in memory •Fetch data in parallel from many shards. Size •Database too big and will not fit on disk/memory on one server GEO latency •You want to shard on GEO and have ’local’ shards close to your users
  • 13. © King Digital Entertainment plc 2014 Getting started 13 Choosing shard-key and type of shard distribution •RANGE, HASH, etc •USER, TIME, etc Operations •Shard move •Shard split •Fail-over / Switch-over Monitoring •Identify quickly growing or ”Hot” shards Interfaces and metadata for sharding •DIY •MySQL Fabric or similar framework
  • 14. © King Digital Entertainment plc 2014 Sharding challenges 14 JOINs •Tables are spread over multiple servers AUTO_INCREMENTs / Sequences •In MySQL these are per table Backups •Coordinating over multiple servers Complex operations •Schema changes, shard splitting, sharding SW Complex HA •Stand-by servers also need to be sharded Management (deploy / orchestration) •Automation a must
  • 15. © King Digital Entertainment plc 2014 Sharding architecture 15 1.Lookup shard for User 100 2.User 100 is on Shard 1 3.Fetch data related to User 100 from shard Shard 1 4.User data for User 100 sent from Shard 1 sh4 sh3 sh2 sh1 META Sharding API Apps 1 2 3 4
  • 16. © King Digital Entertainment plc 2014 Sharding Frameworks 16 MySQL Fabric •Based on plain old MySQL Replication •Requires GTID •Fabric aware connectors •Automatic failover
  • 17. © King Digital Entertainment plc 2014 Sharding Frameworks 17 MySQL Cluster •Automatic sharding •Shared nothing architecture •No SPOF •IMDB •ndbmtd, ndb_mgm, and API nodes
  • 18. © King Digital Entertainment plc 2014 Sharding Frameworks 18 Gizzard (Twitter) DbShards Hibernate Shards ScaleBase Many in-house custom made solutions
  • 19. © King Digital Entertainment plc 2014 Scaling Candy Crush Saga 19
  • 20. 20 Scaling Candy Crush Saga Candy Crush Numbers: 849M game plays per day 84M Candy Crush DAU Served by MySQL As of Q2 2014 © King Digital Entertainment plc 2014
  • 21. 21 ShardingCandy Crush Saga Sharding architecture in place before Candy Crush explosion Only 4 people in Operations 10-20 new DB servers deployed every month at peak (+ ~50 App servers + Memcached + BI) No dedicated DB staff © King Digital Entertainment plc 2014
  • 22. © King Digital Entertainment plc 2014 Architecture overview 22
  • 23. © King Digital Entertainment plc 2014 Architecture overview 23 250 000requests / s 50 000writes / s (60 MB/s) 1 800 000reads / s 250 000writes / s As of Q2 2014
  • 24. © King Digital Entertainment plc 2014 Regular operation 24 MySQL Sharding
  • 25. © King Digital Entertainment plc 2014 MySQL Numbers 25 User-Shards: •> 50TB •> 500K qps •10/1 Read/Write •Several billion row tables •100+ instances •MySQL 5.1 and 5.6 (5.0 and 5.5 used for inhouse applications) •Memcached: Roughly 2M qps •App servers caches in front of Memcached As of Q2 2014
  • 26. © King Digital Entertainment plc 2014 MySQL Numbers 26 •Hardware ################################################################################ #### hostXXX (debian/7.4 -Linux 3.2.0-4-amd64) #### #### XYXXYZXYZXYZXYZ member of: SOME IMPORTANT GROUP #### #### ProLiant DL380p Gen8 #### #### Intel(R) Xeon(R) CPU E5-2695 v2 @ 2.40GHz 48x2.4 Ghz #### #### 379 GB #### ################################################################################ SSDs in RAID10 for data HDDs in RAID 10 for logs
  • 27. MySQL @ King 27 Main database technology at King Backs all our games Plenty of other applications are backed by MySQL •Customer support •Custom built BI/Analysis applications •Buisness Systems (Collaboration, issue tracking, etc) •Other internal applications, e.g., developer support utilities © King Digital Entertainment plc 2014
  • 28. © King Digital Entertainment plc 2014 Database tier 28 The butter and cream of the storage world: MySQL + Memcached Makes everything better!
  • 29. © King Digital Entertainment plc 2014 MySQL Requirements 29 Mission Critical Critical functions break without it Mobile clients can playwithout connectivity. Client game state overrides on reconnect Sub millisecond response time expected. > 10ms generates alarm and throttling of database usage No bank
  • 30. © King Digital Entertainment plc 2014 Database Architecture and Setup 30 Game state data for all users are stored No pruning or purging State stored as JSON blob Sharded MySQL databases UID sharding key One central MySQL shard catalogue data
  • 31. © King Digital Entertainment plc 2014 Application load patterns 31 Almost exclusively Key-Value Friend data read on client start up. Populates Saga. No joins in shards Some JOIN and more SQL in shard catalogue Sharded, highly available, KV-Store, JSON (Recognize this architecture?)
  • 32. © King Digital Entertainment plc 2014 Sharding Implementation 32 Central store used for •User/Shard lookup •Purchases •Registration •Application management console for Configuring Shard/Instance mappings Application user configuration Marketing etc Performance monitioring User Shards used for game state Data volume main issue Rich toolkit for application management Building tools for MySQL management
  • 33. © King Digital Entertainment plc 2014 HA and Tooling 33 KISS Master/Slave pairs. No automatic failovers Shard catalogue has multiple slaves Home built tools for switching, installing, provisioning, moving shards, etc Cacti, VividCortex, MEM, Ganglia, Graphite Nagios Xtrabackup/mysqldump Percona toolkit
  • 34. © King Digital Entertainment plc 2014 Monitoring of our databases! 34
  • 35. 35 Challenges @ King HDD performance Data Volume HDD => SSD 100G => SSD 200G => SSD 400G Delivery times for new HW Racking Buy batches of pre-rackedHW Network capacity issues (Memcached/backups) Hetergenous environment © King Digital Entertainment plc 2014
  • 36. 36 Challenges @ King Relations/Friendships/Joins: joins avoided Volume: one of our main issues Performace/Scalability: Working great Complex Operations: problematic, lots of new components needed + consolidations, standardization Backups: Taken lots of work. Needs more Monitoring: App good. DB not yet stable DB Connections: Typical app server issues. 10K+ connections to DB © King Digital Entertainment plc 2014
  • 37. 37 Solutions Sharding. Just worked Throwing HWat problems MySQL, easy to use, well known, stable, plenty of 3rd party tools, multiple vendors, etc. Get more staff © King Digital Entertainment plc 2014
  • 38. Conclusion 38 Pros: Scaled out with very few problems. All games on one DB tier. Cons: Very rawMySQL environment. No automationand tooling. Resource allocationskew. © King Digital Entertainment plc 2014
  • 39. © King Digital Entertainment plc 2014 Current & Future Work 39 Managing the environment: Fire fighting, maintenance, new features, etc Data Volume management: InnoDB native compression, application compression, avoiding fragmentation (current workload fragments a lot) Automation, tooling, and Spring Cleaning of organically grown MySQL environment Document & Standardize Resource Utlization: CPU in abundance, storage scarce Migrate to 5.6 (so we can migrate to 5.7?) Improvementsto data-model, HW, new-games/new features Backupsolution improvements. DR improvements. Consolidationof minor in-house apps Handling number of connections
  • 40. © King Digital Entertainment plc 2014 Q & A Yes! We are hiring!! about.king.com/jobs 40
  • 41. Thank you © King Digital Entertainment plc 2014 41