# 云南1900万数据测试说明 ================================================================================ [TOC] ## 测试目的 通过读取kudu数据库中存储的1900万矢量数据,测试spark中内存的消耗,以及计算的时间。 ## 测试说明 本次测试只是对kudu数据库的数据进行读取,并进行算子转换,并没有对数据进行实质性的集合计算。只是再对读取和转换之后的的RDD进行打印。这次主要测试的转换之后的SpatilRDD,并对这个SpatialRDD进行一系列转换,包括转成geoJson、keyValueMap、valueList、几何字段转换成wkt、Geometry对象等。分别对这些RDD进行foreach打印。最后再对spatialRDD进行collect聚合操作。 foreach和collect算子说明: collect算子:将集群中其他节点的数据拉去driver所在的机器上如果数据量比较大时,容易造成内存溢出 foreach遍历数据是在从节点上执行,collect是在driver机器上执行 ## 集群环境 | 机器 | 服务节点 | cpu | 内存 | 备注 | | ------------- | -------- | --- | ---- | ---- | | 192.168.20.11 | Master | 8核 | 16G | | | 192.168.20.12 | Worker | 8核 | 16G | | | 192.168.20.13 | Worker | 8核 | 16G | | | 192.168.20.14 | Worker | 8核 | 16G | | ## 测试步骤 1.通过spark读取kudu数据(1900万),形成spatialRdd 2.进行算子转换toGeoJson、toKeyValueMap、toValueList、toWKT、toGeometry等,并进行foreach打印 3.对spatialRDD进行collect聚合 ## 测试参数 --conf spark.datastore.map.nums=100 --executor-memory 10G //excutor内存设置10G ## 测试结果 toGeoJson、toKeyValueMap、toValueList、toWKT、toGeometry算子都能进行foreach打印,但是执行collect算子再Draver端聚合(192.168.20.11机器)出现了内存不够的现象。整个测试计算花费时间为33分钟。 # sum groupBy测试: ## 纯sum ### 测试条件 String geom = "MULTIPOLYGON (((102.15 24.33, 102.15 26.33, 103.66 26.33, 103.66 24.33, 102.15 24.33)))"; // kunming 与该几何体相交 ### 性能 耗时8540ms ## 测试裁剪 ### 测试条件 Area(intersection(the_geom,'MULTIPOLYGON (((102.15 24.33, 102.15 26.33, 103.66 26.33, 103.66 24.33, 102.15 24.33)))')) / Area(the_geom) * tbmj ### 性能 耗时108084ms # Presto-kudu集群测试(没有集成index的查询测试) ## 集群环境 ### 注意事项 160机器一个节点,共用2个角色,Coordinator和Worker,实际生产环境禁止这样 +---------------+-------------+-----+------+------+ | 机器 | 服务节点 | cpu | 内存 | 备注 | +---------------+-------------+-----+------+------+ | 192.168.3.160 | Coordinator | 8核 | 32G | | +---------------+-------------+-----+------+------+ | 192.168.3.160 | Worker | 8核 | 32G | | +---------------+-------------+-----+------+------+ | 192.168.3.161 | Worker | 8核 | 32G | | +---------------+-------------+-----+------+------+ | 192.168.3.162 | Worker | 8核 | 32G | | +---------------+-------------+-----+------+------+ ## 数据量 19071466 ## 查询语句: ### count select count(*) from t530524_f t 查询时间:1s内 ### 属性查询 select dlbm from t530524_f where dlbm = '420'; 查询时间:1秒内 ### 属性模糊查询 select dlbm from t530524_f where dlbm like '%50%'; 查询时间:7-8秒 查询说明:遍历完全表,没有数据返回,时间为最坏情形下时间 select dlbm from t530524_f where dlbm like '%10%'; 查询时间:1秒内有结果返回 ### 几何查询 select count(*) from t530524_f t where st_intersects(the_geom, st_geometryfromtext('MULTIPOLYGON (((102.15 24.33, 102.15 26.33, 103.66 26.33, 103.66 24.33, 102.15 24.33)))')); 查询时间:75秒 select dlbm, sum(tbdlmj) from t530524_f t where st_intersects(the_geom, st_geometryfromtext('MULTIPOLYGON (((102.15 24.33, 102.15 26.33, 103.66 26.33, 103.66 24.33, 102.15 24.33)))')) group by dlbm; 查询时间:84秒 ### groupBy select dlbm, sum(tbdlmj) from t530524_f t group by dlbm; 查询时间:10秒