使用spark-sql-perf评测spark 2.0

文章分为四个部分讲述怎样使用spark官方评测工具评测spark 2.0 tpc ds支持情况

  1. 基础环境的安装
  2. davies/tpcds-kit 下载、编译、部署
  3. databricks/spark-sql-perf 下载、打包
  4. 运行TPCDS测试

基础环境的安装

刀片机:1台 126G内存 64核心 centos 7.2

virtualbox安装四台虚拟机(centos 7.2,16G内存,4核):master,worker1,worker2,worker3(centos下)

spark版本:2.0

hadoop版本:2.6

安装请参考:hadoop安装或者Spark On Yarn安装

安装后的截图

HDFS集群

Spark集群

davies/tpcds-kit 下载、编译、部署

简介

davies/tpcds-kit是用来生成测试数据的工具

下载

git clone https://github.com/davies/tpcds-kit.git

编译

任选一台机器(这里我们选择master)安装以下编译工具(默认软件里没有编译工具)

yum   install gcc gcc-c++ bison flex cmake ncurses-devel
cd    tpcds-kit/tools
cp    Makefile.suite Makefile #复制Makefile.suite为Makefile
make             #运行make命令

接下来,拷贝tpcds-kit到所有机器的相同目录下(重要

scp  -r /目录/tpcds-kit root@worker1:/目录/tpcds-kit  #执行三次该命令复制到worker1,worker2,worker3

databricks/spark-sql-perf 下载、打包

下载

git clone https://github.com/databricks/spark-sql-perf.git

打包

使用sbt package打包的jar在使用时会出现依赖找不到情况,我们使用Intellij Idea导入该工程

修改sbt.build,更改scala版本为2.11.8 Scala版本

打包成jar包

设置Project Structure

step 1

设置Artifacts

step 2

Build

step 3

jar包不需要每个节点都有

运行TPCDS测试

更改spark.env中的driver内存限制

SPARK_DRIVER_MEMORY=8G #依具体情况而定

运行spark-shell

cd   spark-2.0.0-bin-hadoop2.6
./bin/spark-shell --jars /jar包目录/spark-sql-perf.jar --num-executors 20 --executor-cores 2 --executor-memory 8G --master spark://master:7077

在spark-shell中运行测试

 // 创建sqlContext
val sqlContext=new org.apache.spark.sql.SQLContext(sc)
import sqlContext.implicits._
// 生成数据 参数1:sqlContext  参数2:tpcds-kit目录  参数3:生成的数据量(GB)
val tables=new Tables(sqlCotext,"/目录/tpcds-kit/tools",1)
tables.genData("hdfs://master:8020:tpctest","parquet",true,false,false,false,false);
// 创建表结构(外部表或者临时表)
// talbles.createExternalTables("hdfs://master:8020:tpctest","parquet","mytest",false)
talbles.createTemporaryTables("hdfs://master:8020:tpctest","parquet")
import com.databricks.spark.sql.perf.tpcds.TPCDS
val tpcds=new TPCDS(sqlContext=sqlContext)
//运行测试
val experiment=tpcds.runExperiment(tpcds.tpcds1_4Queries)

在spark-shell中我们可以调用 _experiment.html_查看执行状态

HDFS上生成的数据截图

生成的数据

运行截图

运行截图

运行结果保存在spark/performance目录下

HDFS上的评测结果截图

评测结果

转载于:https://my.oschina.net/u/697744/blog/805428

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值