mysql新技术研究与实践

26
1 MySQL 新新新新新新新新 新新新 @Taobao DBA 2010-12-06 iData Forum

Upload: orczhou

Post on 15-Jan-2015

3.973 views

Category:

Documents


2 download

DESCRIPTION

 

TRANSCRIPT

Page 2: MySQL新技术研究与实践

Power by Taobao DBA

关于主题• Performance / Flashcache ...

– Hardware– Software

• Patches– InnoDB-SSD Online file added ......– OSC from FB

Page 3: MySQL新技术研究与实践

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

Page 4: MySQL新技术研究与实践

Power by Taobao DBA

Hardware

• Disk / Memory

• Memory

Page 5: MySQL新技术研究与实践

Power by Taobao DBA

Why Flashcache

SSD vs PCIe-SSD

Winner: PCIe-ssd

Page 6: MySQL新技术研究与实践

Power by Taobao DBA

PICe SSD

• FusionIO

• 特点• 高 IOPS• 容量较小

virident

Page 7: MySQL新技术研究与实践

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

Page 8: MySQL新技术研究与实践

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

Page 9: MySQL新技术研究与实践

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

Page 10: MySQL新技术研究与实践

Power by Taobao DBA

安装

• 参考 Flashcache README

./flashcache_create cachedev /dev/fio /dev/sda12

mount /dev/mapper/cachedev /u01

Page 11: MySQL新技术研究与实践

Power by Taobao DBA

WB vs WT

• Write back– High performance– main version of flashcache

• Write through– more safe– Less performance

Page 12: MySQL新技术研究与实践

Power by Taobao DBA

Another side

• Hot data distribution– Sample 1.5TB SAS + 320GB

Fio

• Keep is simple , stupid

• Maybe your are rich

Page 13: MySQL新技术研究与实践

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

Page 14: MySQL新技术研究与实践

Power by Taobao DBA

InnoDB Plugin/Percona

• Percona is Cool

• InnoDB is Fine

Page 15: MySQL新技术研究与实践

Power by Taobao DBA

MySQL Version

Page 16: MySQL新技术研究与实践

Power by Taobao DBA

压缩特性• Sample Page

Page 17: MySQL新技术研究与实践

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

Page 18: MySQL新技术研究与实践

Power by Taobao DBA

Other Feature

• Buffer Pool

• Faster recovery | Faster index create ...

Page 19: MySQL新技术研究与实践

Power by Taobao DBA

Patch From Taobao

• InnoDB-SSD

• No more connection

• Online tablespace added

• ... Table DML statistics ...

Page 20: MySQL新技术研究与实践

Power by Taobao DBA

Why patch

• Should we change something?

Page 21: MySQL新技术研究与实践

Power by Taobao DBA

Main Contributor

• 林晓斌 From Taobao.com

Page 22: MySQL新技术研究与实践

Power by Taobao DBA

Patch.1 SSD

• Write Through– 读优化

Page 23: MySQL新技术研究与实践

Power by Taobao DBA

Patch.2 No more connection

• Close the door

• Why not – max_connection

Page 24: MySQL新技术研究与实践

Power by Taobao DBA

Patch.3 Online data added

• InnoDB share table space– You must restart your Database

我们不想因此而降低可用性

Page 25: MySQL新技术研究与实践

Power by Taobao DBA

Patch 4 Table dml

• 开发中 ...

• It’s cool

Page 26: MySQL新技术研究与实践

Power by Taobao DBA

Q & A