《(高小明)Greenplum6-混合負載的理想數據平臺(51頁).pdf》由會員分享,可在線閱讀,更多相關《(高小明)Greenplum6-混合負載的理想數據平臺(51頁).pdf(51頁珍藏版)》請在三個皮匠報告上搜索。
1、Greenplum 6:混合負載的理想數據平臺高小明全球領先的開源MPP大數據平臺 可可擴擴展性展性 ACID事事務務VS 分布式分布式 簡單簡單易用易用VS結結構化構化 半半結結構非構非結結構化構化VS 事事務務型型 分析型分析型VSMPP-massively parallel processing-大大規規模并行模并行處處理理masterstandbyprimary segmentmirror segment6Pivotal ConfidentialInternal Use Only數據分布:并行化的根基最重要的策略和目標是均勻分布數據到各個數據節點。43Oct 20 20051264Oc
2、t 20 200511145Oct 20 20054246Oct 20 20056477Oct 20 20053248Oct 20 20051250Oct 20 20053456Oct 20 200521363Oct 20 20051544Oct 20 200510253Oct 20 20058255Oct 20 200555CREATE TABLE orders(id serial,order_date timestamp)Distributed by(id);7Pivotal ConfidentialInternal Use OnlySELECT customer,amount FROM
3、orders JOIN customer USING(cust_id)WHERE date=2008;生成并行查詢計劃8Pivotal ConfidentialInternal Use Only執行并行計劃StandbyMasterMasterHostInterconnectSegment HostNode1Segment HostNode2Segment HostNode3Segment HostNodeNGreenplum(MPP)Oracle(SMP)OLAP-Online Analytical Processing-聯聯機分析機分析處處理理Gartner 2019數據分析行業報告Piv
4、otal Greenplum scored highly this year in all four use cases,positioning among the top vendors in all bar the context-independent data warehouse use cases.This reflects one of the major trends in the DMSA market this year:rediscovery.End users are turning to traditional technologies in order to meet
5、 their DMSA requirements,and Pivotal Greenplums strong capabilities here as an MPP relational database are well-showcased12Pivotal ConfidentialInternal Use Only卓越的OLAP特性列式存列式存儲儲分區、壓縮高高級級特性特性遞歸查詢、窗口函數集成分析集成分析多格式、多語言Madlib:機器學機器學習習數據庫內并行模型訓練和預測、分類ORCA復雜查詢優化器成熟成熟穩穩定定完備生態、支撐核心生產系統13Pivotal ConfidentialI
6、nternal Use Only列式存儲表SALES表SALES更適合壓縮查詢部分列時速度快不同列可以使用不同壓縮方式amountcust_id表 orders14Pivotal ConfidentialInternal Use OnlySegment 1ASegment 1BSegment 1CSegment 1DSegment 2ASegment 2BSegment 2DSegment 3ASegment 3BSegment 2CSegment 3CSegment 3D分區SELECT COUNT(*)FROM orders WHERE order_date=Oct 1 2007 AND
7、order_date$3 and(extract(epoch from tran_date)-extract(epoch from now()/3600$4 and st_distance_sphere(st_makepoint($5,$6),st_makepoint(c.lng,c.lat)/1000.0$3 and(extract(epoch from tran_date)-extract(epoch from now()/3600$4 and st_distance_sphere(st_makepoint($5,$6),st_makepoint(c.lng,c.lat)/1000.0$2
8、00232018GREENPLUM:A PIVOTAL MOMENTNo content leftof this lineNo content leftof this lineNo content rightof this lineNo content rightof this linePlace contentbelow this linePlace contentbelow this lineSource andFootnotes Guideline.PROD Space usage(compressed)1.24 個生產集群2.2個選項:20個節點或 40個節點3.600+服務器,13k
9、+核,81PB存儲(增長中)4.2.5PB 或 25PB 原始數據 按10 x壓縮率 1234Greenplum在摩根士丹利在摩根士丹利OLTP-Online transaction processing-聯聯機事機事務處務處理理出色的出色的OLTP特性特性天生的天生的優勢優勢行式存儲索引直接分發完整的增刪改Greenplum 6 增增強強并發修改、刪除系統性的優化事務和鎖26Pivotal ConfidentialInternal Use Only行式存儲表SALES表SALES更適合OLTP負載高效更改和刪除適合需要全部或者多數列的查詢表 orders索引索引Greenplum支持以下索引
10、:BtreeBitmapGistGIN BRIN (開發中)10ms的訪問時間,即使是上億條記錄 100 不同值B-TreeBitmap 地理空間 區域Gist文本倒排索引GIN28Pivotal ConfidentialInternal Use OnlySegment 1ASegment 1BSegment 1CSegment 1DSegment 2ASegment 2BSegment 2DSegment 3ASegment 3BSegment 2CSegment 3CSegment 3D直接分發SELECT*FROM ordersWHERE id=1;Segment 1ASegment 1
11、BSegment 1CSegment 1DSegment 2ASegment 2BSegment 2CSegment 2DSegment 3ASegment 3BSegment 3CSegment 3DUPDATE ordersSET cust_id=2WHERE id=2;29Pivotal ConfidentialInternal Use Only完整的增刪改查表SALES表SALES讀和寫不阻塞支持更改刪除、刪除支持更改分布鍵、主鍵(將數據從一個節點移到另一個節點)30Pivotal ConfidentialInternal Use OnlyGreenplum 6:并發改刪和分布式死鎖檢
12、測全局死鎖檢測gpconfig-c gp_enable_global_deadlock_detector-v on31Pivotal ConfidentialInternal Use OnlyGreenplum 6:鎖和事務的優化表SALES表SALES大幅減少事務開始和結束時的鎖沖突消除隱式只讀操作(單條SELECT)的鎖沖突避免顯式只讀事務(BEGIN-SELECT-END)的兩階段提交(開發中)fastpath鎖(PostgreSQL合并)32Pivotal ConfidentialInternal Use OnlyTPC-B基準測試:環境基于谷歌云平臺(基于谷歌云平臺(Google C
13、loud Platform,簡簡稱稱GCP),),為為5個虛個虛擬擬主機的集群,包含一主機的集群,包含一個個master主機和四個主機和四個segment主機,主機,master和和segment虛虛擬擬主機的配置信息如下主機的配置信息如下mastersegment虛擬機類型n1-standard-16n1-standard-8CPU核數168內存大?。℅B)6030CPU平臺Intel Haswell存儲類型SSD persistent disk存儲大?。℅B)512Linux發行版Ubuntu Linux 18.04Linux內核版本4.15.0GCC版本7.3.033Pivotal Co
14、nfidentialInternal Use OnlyTPC-B基準測試:SELECT表SALES表SALES3.5倍的TPS提升master CPU使用率大幅提高TPS隨著master CPU核數增加同步提高22萬 TPS(192核單機部署,master+18 segments)34Pivotal ConfidentialInternal Use OnlyTPC-B基準測試:UPDATE得益于并發更改特性70倍的TPS提升35Pivotal ConfidentialInternal Use OnlyTPC-B基準測試:INSERT峰值TPS提升3.6倍36Pivotal Confidenti
15、alInternal Use OnlyTPC-B基準測試:多語句表SALES表SALES峰值TPS提升60倍BEGIN;UPDATE pgbench_accounts SET abalance=abalance+:delta WHERE aid=:aid;SELECT abalance FROM pgbench_accounts WHERE aid=:aid;UPDATE pgbench_tellers SET tbalance=tbalance+:delta WHERE tid=:tid;UPDATE pgbench_branches SET bbalance=bbalance+:delta
16、 WHERE bid=:bid;INSERT INTO pgbench_history(tid,bid,aid,delta,mtime)VALUES(:tid,:bid,:aid,:delta,CURRENT_TIMESTAMP);END;HTAP-Hybrid transactional/analytical processing-混合事混合事務務/分析分析處處理理Gartner技術成熟度曲線OLTP-OLAP獨立部署OLTP數據庫OLAP數據倉庫實時性數據同步復雜性應用復雜性HTAPHTAP=?卓越的OLAP特性出色的OLTP特性多態存儲有效的并發和資源管理OLTP-OLAP獨立部署OLT
17、P數據庫OLAP數據倉庫實時性數據同步復雜性應用復雜性43Pivotal ConfidentialInternal Use Only多態存儲列存儲更適合壓縮查詢列子集時速度快不同列可以使用不同壓縮方式:zstd,gzip(1-9),quicklz,delta,RLE訪問多列時速度快支持高效更新和刪除AO 主要為插入而優化表SALES11月列存列存儲儲行存行存儲儲7月一年前二年前外部表外部表歷史數據和不常訪問的數據存儲在 HDFS 或者其他外部系統中無縫查詢所有數據Text,CSV,Binary,Avro,Parquet 格式6月5月10月9月8月用戶自定義數據存儲格式并發管理pgbouncer
18、資源組(resource group)create resource group rg1(cpu_rate_limit=20,memory_limit=10,concurrency=5)資源管理:CPU使用受限和超限資源管理:CPU,短查詢延遲更穩定延遲,CPUSET特性:create resource group rg1(cpu_set=4,5,memory_limit=10,concurrency=5)資源管理:內存隔離segment級資源組查詢共享全局segment級資源組內資源管理:磁盤配額SELCT diskquota.set_schema_quota(s1,1 MB);SELECT diskquota.set_role_quota(u1,1 MB);客戶案例通過kafka近實時(500ms1s)間隔加載:100萬/s簡單查詢1000并發:1s內返回復雜關聯查詢:s級返回數據量數據量機器數機器數表個數表個數索引個數索引個數并并發發數數插入插入間間隔隔平均平均時時延延最最長時長時延延插入速度插入速度9.8億1841216500ms170ms1100ms300萬/s展望展望Greenplum 6.x/7PostgreSQL合并:BRIN索引和并行掃描鎖和事務的優化磁盤IO的資源管理更多思路?