Scaling MySQL Writes Through Partitioning
Scaling MySQL Writes Through Partitioning
The Tests
Breakthroughs
ConFoo / 2010-03-10
$ finger philip
Philip Tellis
philip@bluesmoon.info
bluesmoon.info
@bluesmoon
yahoo
geek
Web requests
Large volume
Access patterns
Hardware setup
MySQL 5.1
Multi-master replication in two colos, 1 remote slave per
master
Only one master writable at any point of time
4GB RAM (later 16GB), Big disk with RAID 10
DB config
innodb_buffer_pool_size=2078M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=8M
innodb_max_dirty_pages_pct=90
innodb_doublewrite=1, innodb_support_xa=1
sync_binlog=0
key_buffer_size=32M, myisam_sort_buffer_size=512k
transaction_isolation=REPEATABLE-READ
Data setup
Test requirements
Test requirements
Test requirements
Test requirements
How I tested
Test 1
Test 3 - innodb_buffer_pool_size=1000
Realisation
Realisation
Test 4 - innodb_flush_log_at_trx_commit=2
Test 5 - innodb_max_dirty_pages_pct=60
innodb_doublewrite=0 - no effect
Server side prepared statements - no effect
transaction_isolation=READ-COMMITTED - no effect
innodb_support_xa=0 - 12% increase in insertion rate
Combination of the best options - negligible effect
What happened?
Schema
CREATE TABLE (
...
) PARTITION BY RANGE( ( time DIV 3600 ) MOD 24 ) (
Partition p0 values less than (2),
Partition p1 values less than (4),
...
Partition p10 values less than (22),
Partition p11 values less than (24)
);
Still running
Terabytes of data
around 8500 inserts per second
Potentially 700+ MM inserts per day
Summary
Thanks, Merci
ConFoo organisers
Exceptional Performance team @ Yahoo!
Monitoring team @ Yahoo!
MySQL Geeks at Yahoo!
contact me
Philip Tellis
philip@bluesmoon.info
bluesmoon.info
@bluesmoon
yahoo
geek
Photo credits