Professional Documents
Culture Documents
Performance Tuning Best Practices: Jay Pipes Community Relations Manager, North America
Performance Tuning Best Practices: Jay Pipes Community Relations Manager, North America
Database
Performance Tuning Best Practices
Jay Pipes
Community Relations Manager, North America
(ay!mys"l#com$
% Copyright MySQL AB The Worlds Most Popular Open Source Database % The Worlds Most Popular Open Source Database
Overview
Sources of Problems
S!" Coding
Ser#er Parameters
& Copyright MySQL AB The Worlds Most Popular Open Source Database & The Worlds Most Popular Open Source Database
Benchmarking Concepts
Record everything
Schema dump
my.cnf files
S$sBench
http%&&s$sbench'sourceforge'net&
m$s(lslap )*'+,-
http%&&de#'m$s(l'com&doc&refman&*'+&en&m$s(lslap'html
supersmack
http%&&///'#egan'net&ton$&supersmack&
M$Bench
http%&&0erem$'1a/odn$'com&m$s(l&m$bench&
) Copyright MySQL AB The Worlds Most Popular Open Source Database ) The Worlds Most Popular Open Source Database
Profiling Concepts
Diminishing returns
Memor$
CP3
I&O )Disk-
4et/ork and OS
* Copyright MySQL AB The Worlds Most Popular Open Source Database * The Worlds Most Popular Open Source Database
Profiling Toolbox
S5OW Commands
http%&&de#'m$s(l'com&sho/
67P".I4
http%&&de#'m$s(l'com&eplain
M$Top
http%&&0erem$'1a/odn$'com&m$s(l&m$top&
http%&&pecl'php'net&package&apd
+ Copyright MySQL AB The Worlds Most Popular Open Source Database + The Worlds Most Popular Open Source Database
Slow Query Log
log_slow_queries=/var/lib/mysql/slow-queries.log
long_query_time=2
log_long_format
http%&&de#'m$s(l'com&doc&refman&*'+&en&log2
tables'html
, Copyright MySQL AB The Worlds Most Popular Open Source Database , The Worlds Most Popular Open Source Database
Profiling Tips
.ccess t$pes
;e/er fields < 4arro/ ro/s < More records per block
Partitioning )*'+,-
Coding guidelines
Common Pitfalls
N56%
for each'''
%+ Copyright MySQL AB The Worlds Most Popular Open Source Database %+ The Worlds Most Popular Open Source Database
Co!ing ui!elines
key_buffer_size != innodb_buffer_size
myisam_sort_buffer_size
6amine Handler_read_rnd_next/Handler_read_rnd
for a#erage si1e of table scans
6amine Innodb_buffer_pool_reads #s
Innodb_buffer_pool_read_requests
innodb_log_file_size
innodb_flush_method
defaults to fs$nc)-
Other ideas
http%&&///'m$s(lperformanceblog'com&
http%&&de#'m$s(l'com&tech2resources&articles&pro2m$s(l2
chL'pdf
Sub(uer$ optimi1ation
M$S!" ;orge
http%&&0pipes'com
0a$Qm$s(l'com