ClickHouse与Presto及Hive性能对比(7亿数据)

数据量

总量7.6亿,机台数据

Hive中数据


DROP TABLE IF EXISTS dwd_ipqc_online;
CREATE EXTERNAL TABLE dwd_ipqc_online
(
    MACH_ID       string COMMENT '機台ID',
    MACH_IP       string COMMENT '機台IP',
    CREATE_TIME   string COMMENT '創建時間',
    IPQC_ONLINEID string COMMENT 'ID',
    INS_TIME      string COMMENT '插入時間',
    PROD_SN       string COMMENT '產品SN',
    DOT_ID        string COMMENT '点位',
    DOT_VALUE     string COMMENT '值'
) COMMENT 'ipqc在線量測记录'
    PARTITIONED BY (`dt` string)
    STORED AS PARQUET
    LOCATION '/warehouse/xx/dwd/dwd_ipqc_online/'
    TBLPROPERTIES ("parquet.compression" = "lzo");

我这边使用的时hive on spark

set mapreduce.job.queuename=hive;
set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
set spark.executor.instances=12;
set spark.executor.cores=4;
set spark.executor.memory=4G;
set spark.default.parallelism=100;
select count(*) from dwd_ipqc_online;

用时90s,8CPU+38G内存

Presto

直接连接使用hive中对应数据

select count(dt) from cut."dwd_ipqc_online";
select count(*) from cut."dwd_ipqc_online";

首次54s,下次38s,占用4CPU+3.5G内存

ClickHouse

将Hive中数据导入ClickHouse

drop table if exists dwd_ipqc_online;
create  table dwd_ipqc_online
(
    mach_id       String comment '機台ID',
    mach_ip       String comment '機台IP',
    create_time   DateTime comment '創建時間',
    ipqc_onlineid String comment 'ID',
    ins_time      DateTime comment '插入時間',
    prod_sn       String comment '產品SN',
    dot_id        String comment '点位',
    dot_value     String comment '值'
)engine =MergeTree
    ORDER BY (create_time)
partition by toYYYYMMDD(create_time)
;

用时0.038s,CPU基本没动,内存一共才用0.6G

总结

之后直接ClickHouse对接源数据库?
离线数据:考虑到ClickHouse表join的问题,应该会采用离线历史数据存放至Hive,可以用Presto先join分析,等需要查询速度快时,关联形成宽表导出ClickHouse的方式提速。
实时数据:采用kafka+spark/flink批量导入ClickHouse的方式,后续还要研究。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值