Dance with MySQL
description
Transcript of Dance with MySQL
![Page 1: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/1.jpg)
1
Dance with MySQL
周振兴@Taobao DBA
2010-06
Manage MySQL with Open source
![Page 2: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/2.jpg)
What MySQL do for us
• 950G data• 650G index
• Total 1.6T• IOPS 18947 • Delta 3.2G
– 8000*1024 = 800W
System A
![Page 3: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/3.jpg)
What MySQL do for us
• System B– 15,0000,0000 records
– Total:4T– Delta
• 1000,000016 *
Uptime:217 days 18 hours 34 min 2 sec
![Page 4: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/4.jpg)
What about my topic
–How to manage 200+ MySQL Instance
![Page 5: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/5.jpg)
What we do• Test
• routine Install
• Find Problem/debug
• Backup
• Monitor
![Page 6: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/6.jpg)
Why
• Why we think about this a lot?– We have 200+ MySQL Instance
Which one you can drop?
Test is about MoneyInstall is about TimeDebug is aboutStability Backup is about SafetyMonitor is about Status
![Page 7: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/7.jpg)
Why Test
• Simple math– Performance increase 10%
• 200*2W *10% = 40W• 200*2W *20% = 80W
What can 80W do ?
![Page 8: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/8.jpg)
Why Test
• Performance• Stable
– Last year >85% accident can be avoided– This year < 5%
![Page 9: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/9.jpg)
How Test
• Sysbench– How to use sysbench
• How many row• Read write rate
![Page 10: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/10.jpg)
How Test
• Why sysbench?
• Why not sysbench?
• Why supersmack?– Data set > 120G – 95% query for 5%data– 80% query for 20% data
![Page 11: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/11.jpg)
How Test
• Supersmack
ALL 10:2
20% 10:2
5% 10:2
ALL 20:2
20% 20:2
5% 20:2
0
200
400
600
800
1000
1200
1400
1600
1800
6*SAS RAID10
7*SSD RAID5
![Page 12: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/12.jpg)
How Test
• Supersmack– Dell PowerEdge 2950 – Mem:24G 6*300 SAS RAID10– We test different PC Server/Hardware
![Page 13: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/13.jpg)
What Test
• Decide which value we chooseInnoDB_IO_CAPACITY
One hour average in blueTow hour average in red
![Page 14: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/14.jpg)
Install
Test Money Sysbench/supersmack
Install Time
Debug Stability
Backup Safety
>mysql_install_auto -h 172.23.119.257 -v 5.1.45
File descriptorSwappiness.......
![Page 15: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/15.jpg)
Debug
• It’s a real complicated work
• One point: tcpdump + mk-query-digest• It’s a talent work
![Page 16: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/16.jpg)
Debug
• tcpdump + mk-query-digest
![Page 17: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/17.jpg)
Backup
• mysqldump is cool– 39G .sql takes 80 min– Restore takes 206 min(3.4)
• Still we need Xtrabackup– On line– No lock– Some environment
• it’s quick && restore is quick
![Page 18: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/18.jpg)
Xtrabackup
• Using InnoDB Redo (Transaction log)
• No effect to the Online system
• Also help u to setup a new slave
• System can be more Available
![Page 19: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/19.jpg)
More backup strategy
• Last 4 Day Last 3 month Last 3 Year
• 1 3 5 mysqldump 2 4 6 xtrabackup
![Page 20: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/20.jpg)
MySQL Monitor
• Quick way: Cacit + RRDTool– Screenshot
![Page 21: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/21.jpg)
What we monitor
• Com_select – Com_insert – Com_update – Com_delete
• Principle: The bigger the system is,
the more simple the basic layer is
• InnoDB– Logical read/write– Physical read/write– Row operation
![Page 22: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/22.jpg)
Finally
Test Money Sysbench/supersmack
Install Time Linux/bash
Debug Stability mk-query-digest / iostat / ...
Backup Safety Xtrabackup
Monitor Status Cacti / RRDTool
• Enjoy....
![Page 23: Dance with MySQL](https://reader035.fdocuments.net/reader035/viewer/2022062301/56814937550346895db67a65/html5/thumbnails/23.jpg)
What I know is so limited
Still I like Sharing
Q & A