Prestodb概述及性能測試

概述內容

(1)簡介

(2)Hive and Prestodb, comparison of functionality

(3)Hive and Prestodb, comparison of performance

 

(1)簡介

Presto是由facebook開發的一個分佈式SQL查詢引擎, 它被設計爲用來專門進行高速、實時的數據分析。它支持標準的ANSI SQL,包括複雜查詢、聚合(aggregation)、連接(join)和窗口函數(window functions)。

Presto框架圖如下:



     下面的架構圖中展現了簡化的Presto系統架構。客戶端(client)將SQL查詢發送到Presto的協調員(coordinator)。協調員會進行語法檢查、分析和規劃查詢計劃。計劃員(scheduler)將執行的管道組合在一起,將任務分配給那些裏數據最近的節點,然後監控執行過程。客戶端從輸出段中將數據取出,這些數據是從更底層的處理段中依次取出的。

     Presto的運行模型和Hive或MapReduce有着本質的區別。Hive將查詢翻譯成多階段的MapReduce任務,一個接着一個地運行。每一個任務從磁盤上讀取輸入數據並且將中間結果輸出到磁盤上。然而Presto引擎沒有使用MapReduce。它使用了一個定製的查詢和執行引擎和響應的操作符來支持SQL的語法。除了改進的調度算法之外,所有的數據處理都是在內存中進行的。不同的處理端通過網絡組成處理的流水線。這樣會避免不必要的磁盤讀寫和額外的延遲。這種流水線式的執行模型會在同一時間運行多個數據處理段, 一旦數據可用的時候就會將數據從一個處理段傳入到下一個處理段。這樣的方式會大大的減少各種查詢的端到端響應時間。



 

 

(2)Hive and Prestodb, comparison of functionality

        √: Yes; ×: No; Blue: The main differences between hive and presto

 

 

hive 0.11.0

presto 0.56

Implement

Java

Java

DataType

 

integer

string

floating point

boolean

map

list

struct

uniontype

×

timestamp

DDL(數據定義語言)

 

create/alter/drop table

×

create view

×

truncate table

×

desc

create index

×

DML(數據操作語言)

 

load data

×

insert

explain

tablesample(基於column做bucket)

group by

order by

having

limit

inner/left/right/full join

union

sub queries

Enhanced Aggregation, Cube, Grouping and Rollup

×

lateral view

×

Function

 

UDF

×

Mathematical Functions

String Functions

Date and Time Functions

Regex

Type Conversion Functions

×

Conditional Functions

Aggregate Functions

Windowing

Distinct

Url

Json

 

功能上,Presto與Hive有幾個不同的地方,也可以說是Presto功能不完善,畢竟Presto推出時間不長,詳見如下:

1. Presto完成沒有數據寫入功能,不能使用create語句建表(可通過CREATE TABLE tablename AS query),建立視圖、導數據。

2. Presto不支持UDF(用戶自定義函數)。

       3. Presto支持窗口函數,但比Hive相對較少。

 

(3)Hive and Prestodb, comparison of performance

測試環境如下:



     由於部分機器涉及應用,暫用4臺機器作爲prestodb的集羣,prestodb所有運算都在內存,所以配置大內存有助於提高prestodb的運算速度(現配置4G)。

以下爲具體的測試結果:

記錄數:169984827

DML

Hive(s)

Prestodb(s)

limit

5.493

0.05

where

49.255

0.05

count(*)

184.974

86

group by

161.633

110

sub queries

105.686

0.09

join

657.006

177

注:prestodb查詢時間只精確到秒,後帶小數忽略



 

參考資料

Prestodb官網:http://prestodb.io/

ZOL頻道:http://jishu.zol.com.cn/78874.html

轉載地址:http://yugouai.iteye.com/blog/2017528

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章