mysql新技术研究与实践
DESCRIPTION
TRANSCRIPT
1
MySQL 新技术研究与实践
周振兴@Taobao DBA
2010-12-06iData Forum
Power by Taobao DBA
关于主题• Performance / Flashcache ...
– Hardware– Software
• Patches– InnoDB-SSD Online file added ......– OSC from FB
Power by Taobao DBA
is about the Capacity
30,0000 / s
Cache Miss
Capacity 20% === 1亿用户
Performance
is also about the Cost && Technology
1,0000 / s
Power by Taobao DBA
Hardware
• Disk / Memory
• Memory
Power by Taobao DBA
Why Flashcache
SSD vs PCIe-SSD
Winner: PCIe-ssd
Power by Taobao DBA
PICe SSD
• FusionIO
• 特点• 高 IOPS• 容量较小
virident
Power by Taobao DBA
Why Flashcache
IOPS 节点数 单点容量500 64 100G
1000 32 200G
2000 16 400GB
4000 8 800GB
8000 4 1.6TB
... ... ...
Some System requirement: 3,0000 iops 6TB
From SSD Performance Blog
Power by Taobao DBA
Flashcache 原理
/dev/sda /dev/sdb
/dev/mapper/cachedev
这就是 Flashcache :将两个块设备,虚拟成一个带缓存的块设备
File System
VFS
http://orczhou.com
Sample 1.5TB SAS + 320GB Fio
Power by Taobao DBA
Flashcache
FIO FIO-LVM FC-WB FIO FC-WT SSD FC-WB SSD
12*SAS 6*SAS 4*SAS0
200
400
600
800
1000
1200
1400
16001456
11441024
490
204 175304
214134
TPS
innodb_flush_log_at_trx_commit = 2innodb_buffer_pool_size = 10Ginnodb_max_dirty_pages_pct = 50select:update:insert=10:1:1
Power by Taobao DBA
安装
• 参考 Flashcache README
./flashcache_create cachedev /dev/fio /dev/sda12
mount /dev/mapper/cachedev /u01
Power by Taobao DBA
WB vs WT
• Write back– High performance– main version of flashcache
• Write through– more safe– Less performance
Power by Taobao DBA
Another side
• Hot data distribution– Sample 1.5TB SAS + 320GB
Fio
• Keep is simple , stupid
• Maybe your are rich
Power by Taobao DBA
A fixed bug
• MySQL hungs with Flashcache
• Latest version has fixed it
iostat 1sda12 0 0 0 0 0 0 0 0 0 0 0fio 0 0 0 0 0 0 0 0 0 0 0dm-0 0 0 0 0 0 0 0 0 0 0 100
Power by Taobao DBA
InnoDB Plugin/Percona
• Percona is Cool
• InnoDB is Fine
Power by Taobao DBA
MySQL Version
Power by Taobao DBA
压缩特性• Sample Page
Power by Taobao DBA
压缩特性• 空间节约
– 788M sns_info.ibd– 376M sns_info.ibd
• 性能– BP can hold more data
16K 8K Compressed0
50
100
150
200
250
300
350
400
450
190
385
Performance Testing
innodb_flush_log_at_trx_commit = 2innodb_buffer_pool_size = 10Ginnodb_max_dirty_pages_pct = 50select:update:insert=10:1:1
Power by Taobao DBA
Other Feature
• Buffer Pool
• Faster recovery | Faster index create ...
Power by Taobao DBA
Patch From Taobao
• InnoDB-SSD
• No more connection
• Online tablespace added
• ... Table DML statistics ...
Power by Taobao DBA
Why patch
• Should we change something?
Power by Taobao DBA
Main Contributor
• 林晓斌 From Taobao.com
Power by Taobao DBA
Patch.1 SSD
• Write Through– 读优化
Power by Taobao DBA
Patch.2 No more connection
• Close the door
• Why not – max_connection
Power by Taobao DBA
Patch.3 Online data added
• InnoDB share table space– You must restart your Database
我们不想因此而降低可用性
Power by Taobao DBA
Patch 4 Table dml
• 开发中 ...
• It’s cool
Power by Taobao DBA
Q & A