Another MySQL Performance Talk
Another MySQL Performance Talk
• MySQL Topologies
How *not* to benchmark
My favorite quote...
• “I tested both MyISAM and InnoDB and accessing the same URL
1000 times it was always faster in MyISAM....”
First past the post tests
suck.
Why?
Why?
• By using the same URL you almost guaranteed that it would be
in:
Why?
• By using the same URL you almost guaranteed that it would be
in:
• The InnoDB buffer pool (both indexes and data) and the InnoDB
adaptive hash
Why?
• By using the same URL you almost guaranteed that it would be
in:
• The InnoDB buffer pool (both indexes and data) and the InnoDB
adaptive hash
• Rarely true.
• Bottlenecks shift.
• http_load
• Similar to ab, can accept an input file of URLs (apache access log
makes a good victim)
• curl $url
Disk RAM CPU or Network?
Potential Bottlenecks
DISK RAM
CPU Network
Potential Bottlenecks
DISK
The number one bottleneck. RAM
Seriously.
CPU Network
Potential Bottlenecks
DISK RAM
The number one bottleneck. Use it to cheat - get out of using
Seriously. your DISK wherever you can.
CPU Network
Potential Bottlenecks
DISK RAM
The number one bottleneck. Use it to cheat - get out of using
Seriously. your DISK wherever you can.
CPU
May report as high if Network
heavy wait I/O.
Potential Bottlenecks
DISK RAM
The number one bottleneck. Use it to cheat - get out of using
Seriously. your DISK wherever you can.
Network
CPU
Maximum throughput is not
May report as high if
normally an issue, but round trips
heavy wait I/O.
add latency.
My Advice:
• lsof
My favorite unixy commands
(cont.)
• ps aux
• uptime
• top
• netstat
• ping -f
My advice: Hard Drives
• Slower drives can’t fsync() fast enough, so you’ll still be write bound.
• You can distribute InnoDB log files or binary log files for better disk
IO distribution
Some things to try...
Internet
www
+ mysql
The next logical step...
mysql
Internet
www
The next logical step (cont.)
mysql
Internet
www
Continued Growth...
slaves
master
Internet
reads
writes
xN
www
When this works...