27
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 1 MySQL之百尺竿頭更進一步 吕漫漪 Snr Manager, MySQL Optimizer Team Sep 2014

Raising The MySQL Bar-Manyi Lu

  • Upload
    -

  • View
    133

  • Download
    0

Embed Size (px)

DESCRIPTION

What's new MySQL 5.7

Citation preview

Page 1: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 1

MySQL之百尺竿頭更進一步

吕漫漪

Snr Manager, MySQL Optimizer Team

Sep 2014

Page 2: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 2

以下僅供說明我們的產品的一般性方向。僅用以為您提供更多的資訊,不可合併到任何合約。不能當成承諾要交付任何產品、程式碼或功能,也不能當作在做採購決策時的依據。甲骨文公司對其產品的開發、發行、和任何功能及特性推出的時間保留所有的權利

Page 3: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 3

百尺竿頭更進一步 為您不斷進步中的MySQL

Page 4: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 4

s

Page 5: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 5

元件

MySQL: 下一代網路應用系統 不論運行於本地, 在雲, 分散式應用系統

Page 6: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 6

MySQL Enterprise Monitor 2.2

MySQL Cluster 7.1

MySQL Cluster Manager 1.0

MySQL Workbench 5.2

MySQL Database 5.5

MySQL Enterprise Backup 3.5

MySQL Enterprise Monitor 2.3

MySQL Cluster Manager 1.1

MySQL Enterprise Backup 3.7

全都正式發行!

Oracle VM Template for MySQL

Oracle Products Certifications

MySQL Windows Installer

MySQL Enterprise Security

MySQL Enterprise Scalability

MySQL Cluster 7.2

MySQL Cluster Manager 1.3

MySQL Utilities 1.0.6

MySQL Workbench 6.0

全都正式發行!

MySQL Enterprise Backup 3.10

MySQL Enterprise Audit

MySQL Windows Tools

MySQL Database 5.6

MySQL Cluster 7.3

MySQL Workbench 6.1

MySQL Fabric 1.4

MySQL Fabric 1.5 RC

MySQL Database 5.7 DMR

*Development Milestone Release

全都正式發行!

可以下載!

引領 MySQL 的創新: 2010 - 2014

Page 7: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 7

• 能完全使用48 CPU 線程

• 達到MySQL 5.5 2.3倍的效能

改善性能和擴充力

• 更好的交易吞吐量和可用性

改善 INNODB

• 查詢執行和查詢調優、偵錯的診斷更快

改善優化器

• 高效能,高可用度和數據正確性

改善複製

• 更好的工具,使用者/應用系統層的統計和監看

改善PERFORMANCE SCHEMA

• 快速,鍵值存取同時完全支持ACID,使開發的方式更靈活

新的! 以NoSQL使用INNODB

MySQL 5.6: 19個月前正式發行– 有史以來最好的發行

Page 8: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 8

感謝MySQL社群 協助建立更好的MySQL

特別要感謝 Justin Swanhart, Laurynas Biveinis, Honza Horak,

Hartmut Holzgraefe, Davi Arnaut 和 Mark Callaghan!

Page 9: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 9

要加入MySQL的團隊嗎?

Page 10: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 10

歡迎WebScaleSQL!

投入改善MySQL更適合大型網路運算

對MySQL社群和新的開發者是很好的消息

甚至使Oracle能更密切合作

感謝, Facebook, Google, LinkedIn 和 Twitter!

Page 11: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 11

5.7 DMR 1 April 2013

DMR 2 Sep 2013

DMR 3 Dec 2013

DMR 4

New features in

labs.mysql.com Available Now!

...

5.6 GA Feb 2013

百尺竿頭更進一步: MySQL 5.7

Page 12: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 12

MySQL Repositories: Yum

以簡化且方便的方式安裝和更新 MySQL相關產品

支援以下發行版本

– RedHat Enterprise/Oracle Linux

– Fedora

– Debian/Ubuntu

包含最新的packages

– MySQL Database

– MySQL Workbench

– MySQL Connector/ ODBC

– MySQL Connector/Python

– MySQL Utilities

對用戶和Linux 發行者都有幫助

同時現在Windows的開發者也可自

NuGet for 下載 http://www.nuget.org/profiles/MySQL/

自repositories下載的次數超過Fedora/RedHat的50%

Page 13: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 13

MySQL 5.7 Sysbench Benchmark

Sysbench Point Select

Intel(R) Xeon(R) CPU X7560 x86_64

5 sockets x 8 cores-HT (80 CPU threads)

2.27GHz, 256G RAM

Oracle Linux 6.5

比MySQL 5.6快兩倍以上

快過MySQL 5.5三倍以上

630,000 QPS

Page 14: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 14

MySQL 5.7: 優化器

問題: 當一個連線的指令用了太久的時間

新的功能: 執行

– EXPLAIN FOR CONNECTION from another session

– 發掘造成延遲的根本原因

– 調優指令

對正在執行中的查詢EXPLAIN

EXPLAIN [FORMAT=(JSON|TRADITIONAL)] FOR CONNECTION <id>;

Page 15: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 15

MySQL 5.7:優化器 "query_block": {

"select_id": 1,

"cost_info": {

"query_cost": "1.00"

},

"table": {

"table_name": "actor",

"access_type": "const",

"possible_keys": [

"PRIMARY"

],

"key": "PRIMARY",

"used_key_parts": [

"actor_id"

],

"key_length": "2",

"ref": [

"const"

],

"rows_examined_per_scan": 1,

"rows_produced_per_join": 1,

"filtered": 100,

"cost_info": {

"read_cost": "0.00",

"eval_cost": "0.20",

"prefix_cost": "0.00",

"data_read_per_join": "280"

},

"used_columns": [

"actor_id",

"first_name",

"last_name",

"last_update"

]

}

}

詳儘的JSON EXPLAIN

– 現在包括所有可用的成本資訊

– 用以在MySQL Workbench 6.1中做視覺化Explain

Page 16: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 16

MySQL 5.7:優化器成本模型

新的成本模型API

使存儲引擎能為鍵值查找、表掃瞄和區段掃瞄等提供正確且動態的成本估計

‒ 以後支持更多外界因素

數據是否在RAM, SSD, HDD

為以後成本能被靈活設定打基礎

‒ 根據您的硬硬體性能特性

改良每個鍵對應多少記錄的估計

成本值含在JSON Explain的輸出中

Page 17: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 17

MySQL 5.7: InnoDB

改進InnoDB 線上Alter Table

– 線上Rename Index, 線上改Varchar

加強FusionIO的整合

– 當偵測到DirectFS時自動關閉Doublewrite buffer

併行 “Dirty Page” Flushing

– 更高的吞吐量、性能和擴充性

Partitions – 支持移動式表空間 (Transportable tablespace)

– DISCARD/IMPORT支持各別的partitions和分区的表

許多改進

Page 18: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 18

MySQL 5.7: InnoDB壓縮

透通的在儲存頁層的壓縮

– 在背景線程中安靜的發生

– 整個在IO層中管理

– 用少數的檔案和在作業系統的核心和檔案系統的 "hole punching"

減少 IO

– 改進性能

– 減少寫的週期,因此增加SSD 的壽命

適用於所有的表,包括系統表空間和UNDO日誌

感謝Fusion-io

labs.mysql.com

Page 19: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 19

MySQL 5.7: Server-side Statement Timeouts

伺服器端指令逾時

– 整個伺服器,各別連線,或各別SELECT指令

基於Davi Arnaut的貢献

– 擴增到Windows和Solaris, 以移除USER選項做限制

感謝Davi Arnaut

SELECT MAX_STATEMENT_TIME = 109 * FROM my_table;

Page 20: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 20

MySQL 5.7: GIS

InnoDB支持空間索引

– 優化R-tree 索引

整合Boost.Geometry

– 改進精確度

– 支持更多的類型,組合和功能

– 改進性能

– 完全支持Open Geospatial Consortium

– 參加Boost.Geometry開發

Page 21: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 21

MySQL 5.7.4: 複製

更高的吞吐量

– 從資料庫 : 即使在同一資料庫中也能併行進行交易

– 主資料庫: 不同複製使用者連線間具有更好的同步能力

DMR4改進主資料庫在半同步複製時的性能

透過強化半同步複製達到無損失的複製

Performance Schema表可監看從資料庫的狀況

動態複製篩選器: 不需重開資料庫就能變更篩選條件

更好的性能, 改進可用度和加強高可用

Page 22: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 22

多源複製 Multi-Source Replication 把多個主庫的更新匯集到一個從庫

– 匯整所有的分庫的資料

– 更有彈性的拓樸結構

– 集中一點做備份,更易製做全域性報表

可以和半同步複製和強化的多線程複製併存

計劃正式發行由主資料庫指定從資料庫的篩選

應用系統必需保持資料源之間是無關連的

Binlog

Master 1

Binlog

Master 2

Binlog

Master N

IO 1

Relay 1

Coordinator

W1 W2 … WX

IO 2

Relay 2

Coordinator

W1 W2 … WX

Coordinator

W1 W2 … WX

IO N

Relay N

Coordinator

W1 W2 … WX

Slave

labs.mysql.com

Page 23: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 23

MySQL多線程從資料庫

演進過程…

– 2010: 同schema內多線程複製(labs)

– 2013:同schema內多線程複製(5.6

GA)

– 2013: 跨schema間多線程複製(5.7.2 DMR)

– 今天: 調整group commit批次的大小 – 交換在主資料庫上的提交之延遲 (labs)

從資料庫的吞吐量提高六倍

使從資料庫能快速跟上主資料庫的變更

labs.mysql.com

0

500

1000

1500

2000

2500

3000

3500

4000

4500

0 4 8 12 16 22 24 28 32 36 40 44 48

Transaconspersecond

SlaveWorkerThreads

SlaveThroughput

LargerBGCbucket

NoMasterImpact

Baseline

Page 24: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 24

MySQL Fabric 1.4 RC (MySQL Utilities 1.4.2)

高可用性:

– 服務器監看,同時在主故障時自動提升適當的從為主,以及應用系統透通的故障移轉

Fabric-aware connectors

– Python, Java, PHP

不需Proxy -> 不會有額外的延遲

透過資料庫分庫達成橫向擴充

– 應用系統提供shard key

– Range或Hash

– 有做重分庫的工具

– 全域性的更新和全域表

H高可用+ 資料庫分庫的方式的橫向擴充

MySQL Fabric

Connector

Application

Read-slaves

SQL

Master group

Read-slaves

Master group

Page 25: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 25

MySQL 為您所做的創新

過去12個月內Oracle所交付的軟體及所做的改進: – 正式發行: MySQL Cluster 7.3, MySQL Workbench 6.0 & 6.1, MySQL

Enterprise Monitor 3.0, MySQL Utilities, MySQL Connectors...還有更多

– DMRs和Labs: MySQL 5.7, MySQL Fabric, 多源複製, Hadoop Applier for

MySQL, GIS, MySQL Cluster 7.4...

Oracle使MySQL成為更適合下一代 網路、雲計算和大數據

的資料 庫

歡迎大家試用同時將您的建議回饋給我們!

Page 26: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 26

Page 27: Raising The MySQL Bar-Manyi Lu

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 28

MySQL 5.7: Performance Schema

更多的探測器

– Stored Procedures和Stored Functions

– Prepared Statements

– 交易

指令探測器

記憶體探測器

– 加入二百多個記憶體類型

依下列歸類記憶體使用的統計

– 記憶體的類型(caches, internal

buffers, …)

– 間接作用於記憶體的線程/帳戶/主機之操作

屬性包括

– 使用的記憶體 (bytes), 操作次數,高/

低水位

記憶體的使用

更多性能指標

– 複製之從服務器狀況

– 增刪改的鎖定探測器

其他資料