Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MySQL - The Old Way
Search
Gea-Suan Lin
July 29, 2012
Technology
4
460
MySQL - The Old Way
Gea-Suan Lin
July 29, 2012
Tweet
Share
More Decks by Gea-Suan Lin
See All by Gea-Suan Lin
High Availability Vault Service on AWS Environment
gslin
0
7.1k
用 AWS CodeDeploy 解決程式佈署
gslin
0
410
MySQL to NoSQL & Search Engine
gslin
0
2k
用 Vagrant 與 Docker 拯救世界
gslin
1
260
Startup IT infrastructure: Developing and Working with AWS
gslin
8
3.6k
Talk about Percona XtraDB Cluster
gslin
0
190
API Design Optimized for Mobile Platform
gslin
9
8.5k
Use Facebook::Graph to write desktop application
gslin
2
500
COSCUP 2012 - MySQL System Stability
gslin
17
12k
Other Decks in Technology
See All in Technology
JavaScript パーサーに using 対応をする過程で与えたエコシステムへの影響
baseballyama
1
110
Capitole du Libre 2025 - Keynote - Cloud du Coeur
ju_hnny5
0
120
プロジェクトの空気を読んで開発してくれるPerlのAIツールがほしい
kfly8
2
100
re:Invent完全攻略ガイド
junjikoide
1
390
旧から新へ: 大規模ウェブクローラの Perl から Go への移行 / YAPC::Fukuoka 2025
motemen
3
1.1k
レビュー負債を解消する ― CodeRabbitが支えるAI駆動開発
moongift
PRO
0
420
Perlブートキャンプ
hatena
0
280
FFMとJVMの実装から学ぶJavaのインテグリティ
kazumura
0
130
Spring Boot利用を前提としたJavaライブラリ開発方法の提案
kokihoshihara
PRO
2
240
米軍Platform One / Black Pearlに学ぶ極限環境DevSecOps
jyoshise
2
490
AIエージェントによるエンタープライズ向けスライド検索!
shibuiwilliam
4
570
ZOZOTOWNカート決済リプレイス ── モジュラモノリスという過渡期戦略
zozotech
PRO
0
460
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
Context Engineering - Making Every Token Count
addyosmani
9
390
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
The Cult of Friendly URLs
andyhume
79
6.7k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
How STYLIGHT went responsive
nonsquared
100
5.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
24
1.6k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Transcript
MySQL - The Old Way Gea-Suan Lin
Old != Bad
In this case, Old implies Reliable
Reliable
We are familiar with these issues,
We can workaround these issues
So...
First Solution
Built-in Replication
http://dev.mysql.com/ doc/refman/5.5/en/ replication.html
The Good Part
Simple
Dead Simple Setup
Dead Simple Concept
Master logs changes
Slave applies changes
The Bad Part
Async
Means...
Replication Lag
When you write data to master,
It’s possible unable to read from slave
Workaround
Always use master if you write data
The Worst Part
Application cannot write after master crash
This derives...
Second Solution
Master-Master
Two MySQL servers
Set each other as master server
The Good Part
Both MySQL servers can be written
The Bad Part
Data inconsistent
MySQL Server A TRUNCATE TABLE t; INSERT t SET i=1;
MySQL Server B TRUNCATE TABLE t; INSERT t SET i=2;
MySQL Server A TRUNCATE TABLE t; INSERT t SET i=1;
TRUNCATE TABLE t; INSERT t SET i=2; MySQL Server B TRUNCATE TABLE t; INSERT t SET i=2; TRUNCATE TABLE t; INSERT t SET i=1;
Result
MySQL Server A i=2 MySQL Server B i=1
Workaround
Write one server in normal case
Write another one when primary node fails
You can write code to handle failover
But we suggest to use Heartbeat
Heartbeat can handle this failover case
When data is inconsistent,
We can use Percona’s pt-table-sync to sync data
Third Solution
DRBD + Heartbeat
DRBD is Network-based RAID-1
Block-level mirror
Heartbeat handles High Availability
http://dev.mysql.com/ doc/refman/5.5/en/ha- drbd.html
http://dev.mysql.com/ doc/refman/5.5/en/ha- heartbeat.html
The Good Part
Data consistent
You won’t need to worry about data inconsistent issue
The Bad Part
Utilization Rate
Only one server uses to serve applications
Warm up time
When I/O rate cannot catch query rate
Conclusion
DRBD has higher down-time than other twos,
And it costs higher in server hardware
But it costs lower for SA Operations
If down-time of DRBD + Heartbeat is acceptable,
You should choose it
How much down- time ?
It depends,
Usually < 30 secs to failover
With warm up time
Possible 3~5 mins for 10GB data size ?
Thanks !