mysql 和 innodb 性能

28
MySQL and InnoDB Performance Baron Schwartz | OSDC 2010

Upload: yucheng-hu

Post on 17-May-2015

790 views

Category:

Technology


5 download

DESCRIPTION

MySQL 和 InnoDB 性能 http://www.ossez.com/forum.php?mod=viewthread&tid=26844&fromuid=426 (出处: OSSEZ)

TRANSCRIPT

Page 1: MySQL 和 InnoDB 性能

MySQL and InnoDB Performance

Baron Schwartz | OSDC 2010

Page 2: MySQL 和 InnoDB 性能

MySQL Architecture

MySQL Server

Storage Engines

Parser, Optimizer

Executor, Caches

Page 3: MySQL 和 InnoDB 性能

InnoDB Storage Engine

• Transactional, ACID compliant

• Reliable, Stable

• Complex, Flexible

• A History of Poor Scalability

Page 4: MySQL 和 InnoDB 性能

Thinking About Performance

Response TimeIs Everything

Page 5: MySQL 和 InnoDB 性能

Response Time

R = W + S

Utilization

Res

po

nse

Tim

e

S

W

Page 6: MySQL 和 InnoDB 性能

Response Time

R = W + S

Utilization

Res

po

nse

Tim

e

S

W

Page 7: MySQL 和 InnoDB 性能

MySQL & InnoDB In Context

Page 8: MySQL 和 InnoDB 性能

MySQL & InnoDB In Context

Operating Environment

MySQL Server

InnoDB

Page 9: MySQL 和 InnoDB 性能

Operating Environment

RAM

CPUI/O

Network

Page 10: MySQL 和 InnoDB 性能

Operating Environment

RAM

CPUI/O

Network

• Fast• Up to 24 Cores

• Up to 100's of GB

• RAID + BBU• Fast SAS Disks• SSD / FusionIO• XFS Filesystem• Deadline Scheduler

• High Bandwidth• Low Latency

Page 11: MySQL 和 InnoDB 性能

MySQL Performance

Nested-Loop Joins and Subqueries

Page 12: MySQL 和 InnoDB 性能

MySQL Performance

Cache Scalability

Page 13: MySQL 和 InnoDB 性能

InnoDB's Single “Main Thread”

• Too Much Work! Purging, Flushing

• Main Thread Cannot Keep Up

Page 14: MySQL 和 InnoDB 性能

Special-Purpose Threads

• Main Thread

• Purge Thread

• Multiple Read/Write IO Threads

Page 15: MySQL 和 InnoDB 性能

InnoDB Mutex Contention

Buffer Pool

Page 16: MySQL 和 InnoDB 性能

Splitting the Buffer Pool Mutex

Buffer Pool Flush List LRU Hash Free

Page 17: MySQL 和 InnoDB 性能

Current InnoDB Bottlenecks

• Adaptive Hash Search Mutex

• Index Lock Mutex

• After These Are Solved, ???

Page 18: MySQL 和 InnoDB 性能

How To Improve Performance

Page 19: MySQL 和 InnoDB 性能

Measure Carefully

Proper diagnosis is 95% of the work

Page 20: MySQL 和 InnoDB 性能

Use Good Tools

• New Relic

• MySQL Enterprise Monitor

• Cacti– http://code.google.com/p/mysql-cacti-templates/

• Maatkit

• GDB, strace, oprofile

Page 21: MySQL 和 InnoDB 性能

Instrumentation is Key

• The best performance data is INSIDE MySQL

Page 22: MySQL 和 InnoDB 性能

Percona Server with XtraDB

MySQL Server

Storage Engines

Parser, Optimizer

Executor, Caches

Tunability

Instrumentation

Diagnostics

Page 23: MySQL 和 InnoDB 性能

Current Benchmarks

Page 24: MySQL 和 InnoDB 性能

InnoDB -vs- XtraDB

http://tinyurl.com/xtradb-fusionio-jan-2010

XtraDB is much better than InnoDB in MySQL 5.1.

Page 25: MySQL 和 InnoDB 性能

MySQL 5.5 -vs- Percona Server

http://tinyurl.com/xtradb-mysql5-5-ap2010

High performance is no use without stability.

Page 26: MySQL 和 InnoDB 性能

Other Technologies

• Cloud Computing– 2 of the 4 critical resources are uncontrollable

• “NoSQL” Databases– It's too soon to be sure

Page 27: MySQL 和 InnoDB 性能

Summary

• The operating environment is important

• MySQL & InnoDB are getting much faster

• The cloud is not a performance solution

• You are the key to better performance

Page 28: MySQL 和 InnoDB 性能

Where Do You Go Next?

• Become a performance practitioner– Read High Performance MySQL 2nd Edition

– Read Optimizing Oracle Performance

– Read The Art Of Capacity Planning– Read http://www.percona.com/about-us/white-papers/

• Contribute!– Sponsor features you need or want

– Help improve tools