# Apache Druid 性能测评

**URL:** <https://www.isharkfly.com/t/apache-druid/13580>\
**Category:** BigData\
**Tags:** druid\
**Created:** [July 19, 2021, 4:42pm UTC](https://www.isharkfly.com/t/apache-druid/13580 "2021-07-19T16:42:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [July 19, 2021, 4:42pm UTC](https://www.isharkfly.com/t/apache-druid/13580/1 "2021-07-19T16:42:30Z")

</div>

# 一.集群配置

![](https://www.isharkfly.com/images/transparent.png)

# 二.角色分布

![](https://www.isharkfly.com/images/transparent.png)

# 三.集群版本

![](https://www.isharkfly.com/images/transparent.png)

# 四.性能测试

## Ⅰ).数据时效性测试

### a).测试案例

> 模拟生产由5000个agent、5000个URL和2类请求方式做为聚合字段的1亿条明细数据，来测试Druid集群在配置不同TaksCount数时，Druid聚合任务的执行时长

- 明细数据：1亿条
- 聚合组合：5000个agent _5000个URL_ 2类Method Type = 5千万
- 创建Topic的partition等于配置TaksCount的个数
- 执行任务，统计kafka磁盘占用和druid任务执行时长  
 ![](https://www.isharkfly.com/images/transparent.png)

### b).测试数据

![](https://www.isharkfly.com/images/transparent.png)

### c).测试结果

- 在相同数据量的情况下，增加TaksCount可以提高druid聚合任务的处理速度
- 同时增加TaksCount会带来系统内存的线性增加

## Ⅱ).Druid生成segment合理性测试

### a).测试案例

> 模拟生产由5000个agent、5000个URL和2类请求方式做为聚合字段的1亿条明细数据，来测试Druid集群在配置不同TaksCount数和不同MaxRowsPerSegment时，Druid聚合任务生成segment大小的合理配置

- 明细数据：1亿条
- 聚合组合：5000个agent _5000个URL_ 2类Method Type = 5千万
- 创建Topic的partition等于配置TaksCount的个数
- 配置不同TaksCount数和不同MaxRowsPerSegment组合  
 ![](https://www.isharkfly.com/images/transparent.png)

### b).测试数据

![](https://www.isharkfly.com/images/transparent.png)

![](https://www.isharkfly.com/images/transparent.png)

### c).性能数据

#### System Summary

![](https://www.isharkfly.com/images/transparent.png)

#### Memory

![](https://www.isharkfly.com/images/transparent.png)

#### Network I/O

![](https://www.isharkfly.com/images/transparent.png)

#### Disk Read

![](https://www.isharkfly.com/images/transparent.png)

#### Disk Write

![](https://www.isharkfly.com/images/transparent.png)

### d).测试结果

- 为提高查询响应，建议segment在300M~700M之间
- 在源数据基础上需统计的dimensions字段一定的情况下，segment大小受MaxRowsPerSegment和TaksCount的共同影响
- 可根据实际测试数据的信息量来选择合理的MaxRowsPerSegment和TaksCount配置

## Ⅲ).冷热数据隔离测试

### a).测试案例

> 模拟生产由5000个agent、5000个URL和2类请求方式做为聚合字段的1亿条明细数据，来测试Druid集群在配置不同TaksCount数和不同MaxRowsPerSegment时，Druid聚合任务生成segment的冷热数据隔离测试

- 明细数据：1亿条
- 聚合组合：5000个agent _5000个URL_ 2类Method Type = 5千万
- 创建Topic的partition等于配置TaksCount的个数
- 根据配置将数据存储分为冷热数据集群，然后依据数据查询场景，将数据加载至对应集群  
 ![](https://www.isharkfly.com/images/transparent.png)

### b).测试数据

> 集群配置规则

![](https://www.isharkfly.com/images/transparent.png)

> 数据加载规则

![](https://www.isharkfly.com/images/transparent.png)

### d).测试结果

- 集群规模大于7个节点，使用冷热数据隔离可提高查询效率
- druid.server.priority=100d的节点，查询热数据时，查询不会路由至冷数据节点

### e).备注热数据节点配置

```auto
druid.server.tier=hot
druid.server.priority=100

```
