SlideShare a Scribd company logo
Submit Search
Upload
Login
Signup
MySQL Scaling Presentation
Report
Tommy Falgout
Follow
Sr. Programmer at Yahoo!
Nov. 6, 2009
•
0 likes
•
1,621 views
1
of
52
MySQL Scaling Presentation
Nov. 6, 2009
•
0 likes
•
1,621 views
Download Now
Download to read offline
Report
Technology
Tommy Falgout
Follow
Sr. Programmer at Yahoo!
Recommended
MySQL 5.5
Ligaya Turmelle
1.9K views
•
41 slides
MySQL 5.1 Replication
Ligaya Turmelle
3.8K views
•
38 slides
UKOUG 2011: Practical MySQL Tuning
FromDual GmbH
1.4K views
•
33 slides
Caching and tuning fun for high scalability @ PHPTour
Wim Godden
1.4K views
•
82 slides
Caching and tuning fun for high scalability
Wim Godden
2.9K views
•
115 slides
Caching and tuning fun for high scalability @ FOSDEM 2012
Wim Godden
11.3K views
•
82 slides
More Related Content
What's hot
Performance Schema for MySQL Troubleshooting
Sveta Smirnova
746 views
•
23 slides
My sql with querys
NIRMAL FELIX
665 views
•
32 slides
Caching and tuning fun for high scalability
Wim Godden
2.4K views
•
83 slides
Architecting cloud
Tahsin Hasan
980 views
•
57 slides
Hadoop on aws amazon
Sandish Kumar H N
494 views
•
6 slides
NetApp ontap simulator
Ashwin Pawar
1.7K views
•
8 slides
What's hot
(20)
Performance Schema for MySQL Troubleshooting
Sveta Smirnova
•
746 views
My sql with querys
NIRMAL FELIX
•
665 views
Caching and tuning fun for high scalability
Wim Godden
•
2.4K views
Architecting cloud
Tahsin Hasan
•
980 views
Hadoop on aws amazon
Sandish Kumar H N
•
494 views
NetApp ontap simulator
Ashwin Pawar
•
1.7K views
Caching and tuning fun for high scalability
Wim Godden
•
3.7K views
Performance Schema for MySQL Troubleshooting
Sveta Smirnova
•
415 views
Backup and restore router configuration
Vasilis Nikitaras
•
169 views
Caching and tuning fun for high scalability @ 4Developers
Wim Godden
•
2.2K views
How to Upgrade Your Database Plan on Heroku and Rails Setup?
Katy Slemon
•
12 views
Basic MySQL Troubleshooting for Oracle DBAs
Sveta Smirnova
•
1.7K views
Stored procedure
baabtra.com - No. 1 supplier of quality freshers
•
705 views
How Can I tune it When I Can't Change the Code?
Sage Computing Services
•
399 views
Performance and Scalability
Mediacurrent
•
6.2K views
Troubleshooting MySQL Performance
Sveta Smirnova
•
2.1K views
Highload Perf Tuning
HighLoad2009
•
1.3K views
Tips for a Faster Website
Rayed Alrashed
•
986 views
Why Use EXPLAIN FORMAT=JSON?
Sveta Smirnova
•
1.8K views
Introduction to MySQL InnoDB Cluster
I Goo Lee
•
286 views
Similar to MySQL Scaling Presentation
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
1.8K views
•
127 slides
SQL Server 2008 Development for Programmers
Adam Hutson
3.2K views
•
23 slides
MySQL & Expression Engine EEUK2013
EEvolutionUK
1.7K views
•
20 slides
My sql.ppt
MAGNA COLLEGE OF ENGINEERING
2K views
•
32 slides
Performance Tuning
Ligaya Turmelle
1.4K views
•
34 slides
Mysql
Rathan Raj
1.1K views
•
28 slides
Similar to MySQL Scaling Presentation
(20)
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
•
1.8K views
SQL Server 2008 Development for Programmers
Adam Hutson
•
3.2K views
MySQL & Expression Engine EEUK2013
EEvolutionUK
•
1.7K views
My sql.ppt
MAGNA COLLEGE OF ENGINEERING
•
2K views
Performance Tuning
Ligaya Turmelle
•
1.4K views
Mysql
Rathan Raj
•
1.1K views
PHP tips by a MYSQL DBA
Amit Kumar Singh
•
2K views
SDPHP - Percona Toolkit (It's Basically Magic)
Robert Swisher
•
1.9K views
Advance Sql Server Store procedure Presentation
Amin Uddin
•
838 views
SQL Server Performance Tuning with DMVs
Franklin Yamamoto
•
1.1K views
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
•
455 views
Caching and tuning fun for high scalability @ phpBenelux 2011
Wim Godden
•
10.9K views
MemSQL 201: Advanced Tips and Tricks Webcast
SingleStore
•
2.1K views
15 Ways to Kill Your Mysql Application Performance
guest9912e5
•
15K views
Caching and tuning fun for high scalability
Wim Godden
•
11K views
Mysql ppt
Sanmuga Nathan
•
6.2K views
TSQL in SQL Server 2012
Eduardo Castro
•
2K views
Optimize the obvious
drhenner
•
565 views
Zend Con 2008 Slides
mkherlakian
•
1.9K views
Getting to Know MySQL Enterprise Monitor
Mark Leith
•
7.4K views
Recently uploaded
TEKART CON 2023
AdedoyinSamuel1
22 views
•
35 slides
Improving Employee Experiences on Cisco RoomOS Devices, Webex, and Microsoft ...
ThousandEyes
60 views
•
25 slides
Announcing InfluxDB Clustered
InfluxData
51 views
•
30 slides
Experts Live Europe 2023 - Ensure your compliance in Microsoft Teams with Mic...
Jasper Oosterveld
54 views
•
76 slides
Webinar: Discover the Power of SpiraTeam - A Jira Alternative To Revolutioniz...
Inflectra
32 views
•
35 slides
Mitigating Third-Party Risks: Best Practices for CISOs in Ensuring Robust Sec...
TrustArc
34 views
•
21 slides
Recently uploaded
(20)
TEKART CON 2023
AdedoyinSamuel1
•
22 views
Improving Employee Experiences on Cisco RoomOS Devices, Webex, and Microsoft ...
ThousandEyes
•
60 views
Announcing InfluxDB Clustered
InfluxData
•
51 views
Experts Live Europe 2023 - Ensure your compliance in Microsoft Teams with Mic...
Jasper Oosterveld
•
54 views
Webinar: Discover the Power of SpiraTeam - A Jira Alternative To Revolutioniz...
Inflectra
•
32 views
Mitigating Third-Party Risks: Best Practices for CISOs in Ensuring Robust Sec...
TrustArc
•
34 views
LLaMA 2.pptx
RkRahul16
•
15 views
How to use the Cataloguing Code Ethics at your day job : a hands-on workshop ...
CILIP MDG
•
30 views
Elevate Your Enterprise with FME 23.1
Safe Software
•
271 views
Keynote: Two years at the British Library... and counting / Alan Danskin (Bri...
CILIP MDG
•
22 views
BuilderAI Proposal_Malesniak
Michael Lesniak
•
84 views
ISO Survey 2022: ISO 27001 certificates (ISMS)
Andrey Prozorov, CISM, CIPP/E, CDPSE. LA 27001
•
73 views
Understanding Wireguard, TLS and Workload Identity
Christian Posta
•
96 views
Enterprise Application and Data Protection on AWS with Amazon FSx for NetApp ...
LilyJang3
•
17 views
Knowledge graph use cases in natural language generation
Elena Simperl
•
83 views
Metadata & Discovery Group Conference 2023 - Day 2
CILIP MDG
•
12 views
Future of Skills
Alison B. Lowndes
•
33 views
Framing Few Shot Knowledge Graph Completion with Large Language Models
MODUL Technology GmbH
•
25 views
Metadata & Discovery Group Conference 2023 - Day 1 Programme
CILIP MDG
•
23 views
The Ultimate Administrator’s Guide to HCL Nomad Web
panagenda
•
50 views
MySQL Scaling Presentation
1.
Strategic MySQL Planning
for Complexity & Growth Or MySQL Scaling for Dummies Thomas Falgout Sr. Developer Yahoo!
2.
3.
Schema Definition
4.
Hardware
5.
Software
6.
MySQL Config
7.
Cache
8.
Monitoring
9.
10.
Developers usually don't
write proper SQL
11.
SQL Statements will
directly affect your performance
12.
13.
1000 very quick
unnecessary queries vs 1 slow query
14.
15.
Your coworkers might
surprise you.
16.
In a good
way.
17.
18.
Quickly show you
how much data your queries are processing
19.
Could spend an
entire session on just this.
20.
But won't.
21.
Read for yourself.
22.
http://dev.mysql.com/doc/refman/5.1/en/explain.html
23.
http://dev.mysql.com/doc/refman/5.1/en/using-explain.html
24.
http://www.percona.com/files//presentations/EXPLAIN_demystified.pdf
25.
LUUUUUCCCYYYYYYY!!!!!
26.
27.
28.
Faster on MyISAM
(stored in table info)
29.
30.
INSERT INTO a
VALUES (1,23),(2,34),(4,33);
31.
To speed up
INSERT operations that require multiple statements, LOCK your tables
32.
Can you use
LOAD DATA? (Import via CSV)
33.
34.
Not much to
say.
35.
36.
37.
DROP table
38.
RENAME tmp table
to table
39.
40.
Aggregate data hourly/daily/per
update/etc.
41.
42.
Send updates through
daemon to load data
43.
44.
UPDATE counts SET
count = count + 42 WHERE id=1
45.
46.
Does not handle
transactions
47.
Faster to Write,
Slightly faster to Read
48.
Uses separate Data
(.MYD), Index (.MYI) and Frame (.frm)
49.
50.
51.
52.
53.
Writes Binary logs
to disk
54.
Doesn't store data
55.
Useful for offloading
replication from the master
56.
Blackhole Sun.
Won't you come. Wash away my data.
57.
58.
59.
http://forge.mysql.com/wiki/Falcon
60.
61.
http://dev.mysql.com/doc/refman/5.1/en/data-size.html
62.
http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html
63.
64.
SMALLINT – 2
Bytes
65.
MEDIUMINT – 3
Bytes
66.
INT – 4
Bytes
67.
BIGINT – 8
Bytes
68.
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html
69.
70.
VARCHAR(N) = X
+ 1 byte. X = Number of actual characters in string.
71.
N & X
= 1 Byte. Unless using utf8 or a multi-byte format
72.
Same rules apply
for BINARY & VARBINARY.
73.
Extra data is
TRUNCATED!!!!!!
74.
That's bad.
75.
http://dev.mysql.com/doc/refman/5.0/en/string-types.html
76.
77.
VARCHAR(255) is 4.x
limitation
78.
When creating a
temp table, it allocates the greatest size of data (255)
79.
80.
81.
82.
83.
TIME = 3
bytes
84.
85.
86.
192.168.101.201 = 11000000.10101000.01100101.11001001
87.
INT UNSIGNED =
4 Bytes!
88.
INET_NTOA => NumberTOAddress
89.
INET_ATON => AddressTONumber
90.
91.
92.
93.
94.
Stores first as
768 Bytes, and then increments into 16k data pages per row per TEXT/BLOB field
95.
96.
97.
Network latency affects
experience
98.
99.
Send all READS
to Slave
100.
Send all WRITES
to Master
101.
102.
Provides HA w/
no Single Point of Failure
103.
Requires 3 servers
(2 Data, 1 Mgmt Nodes)
104.
Inserts on one
DB are replicated to others
105.
Selects can be
performed on any DB
106.
http://dev.mysql.com/tech-resources/articles/mysql-cluster-for-two-servers.html
107.
http://www.lod.com/whitepapers/mysql-cluster-howto.html
108.
109.
110.
Failover
111.
Query Analysis
112.
113.
114.
Table Sync (Resolve
Differences)
115.
Visual Explain (Explain!
Visually!)
116.
Heartbeat (Shows Slave
Replication Delay)
117.
118.
119.
Point Slaves to
Master
120.
Put Slaves Behind
Load Balancer
121.
122.
Batch Insert /
Update
123.
Don't Delete
124.
Partition your Data
125.
126.
127.
table_cache
128.
innodb_buffer_pool_size
129.
130.
131.
Size of cache
for MyISAM Indexes
132.
133.
key_reads
134.
key_write_requests
135.
key_writes
136.
key_reads/key_read_requests < 0.01
== GOOD
137.
138.
This dictates the
number of open file descriptors
139.
140.
Size in bytes
of the memory buffer InnoDB uses to cache data and indexes.
141.
Default 8MB
142.
143.
Great for tables
that don't change often
144.
Doesn't return stale
data
145.
Cache is invalidated
if returned entry is modified
146.
Another reason why
SELECT(*) is bad
147.
148.
MyISAM – Leave
more memory for OS page caches
149.
150.
Use long_query_time to
specify x
151.
~1 sec is
good starting point
152.
http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
153.
154.
Originally created by
LiveJournal to handle scale
155.
EASY Button
156.
$memcache_obj = memcache_connect("localhost",
11211);
157.
$memcache_obj->add('var_key', 'test variable');
158.
$var = $memcache_obj->get('var_key');
159.
160.
161.
mysqlslap -u root
-concurrency=10000 -iterations=5 -number-of-queries=10000 -query=”SELECT name FROM city WHERE city_id=12”
162.
163.
Like mysqlslap
164.
165.
166.
167.
SHOW GLOBAL STATUS
168.
SHOW GLOBAL VARIABLES
169.
170.
MUNIN – Similar
to Cacti, but easier to maintain
171.
Nagios – More
of a notification tool
172.
MySQL Enterprise Dashboard
– Notification & Monitoring
173.
174.
Be descriptive
175.
Avoid reserve words
(date, time, timestamp)
176.
177.
178.
Break your software.
179.
180.
The Most Important
Lesson This part is absolutely important that you get. It's time to wake up.
181.
The Most Important
Lesson When you need to, Ignore everything I've suggested.
182.
Thanks Thanks for
listening.
183.
Links Flickr -
Scaling MySQL http://www.scribd.com/doc/21593/Scaling-PHPMySQL Very Basic PHP & MySQL: http://www.cs.gsu.edu/~stefan/teaching/csc-6370/notes/phpmysql.pdf JPIPES! http://jpipes.com/presentations/joinfu/joinfu_part_one.pdf http://jpipes.com/presentations/joinfu/joinfu_part_two.pdf http://jpipes.com/presentations/dqm/legend_drunken_query_master.pdf EXPLAIN: http://www.percona.com/files//presentations/EXPLAIN_demystified.pdf Query Optimization: http://www.percona.com/files//presentations/Zurich2007-QueryOptimization.pdf Server Settings Tuning: http://www.percona.com/files//presentations/UC2007-MySQL-Server-Settings-Tuning.pdf http://www.flupps.org/mysql/MySQL_Microscope.ppt http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html http://www.devshed.com/c/a/MySQL/MySQL-Server-Tuning-Tips-and-Tricks/ http://www.planetmysql.org/