InfluxDB2.x 基准测试工具 - influxdb-comparisons

一、前言

influxdb-comparisons 是 influxdata 官方提供的基准测试工具,支持 influxDB v1 与 v2 版本,支持以下数据库的基准测试:

  • InfluxDB
  • Elasticsearch (announcement blog here)
  • Cassandra (InfluxDB Tops Cassandra in Time-Series Data & Metrics Benchmark)
  • MongoDB (InfluxDB is 27x Faster vs MongoDB for Time-Series Workloads)
  • OpenTSDB
  • TimescaleDB
  • Graphite
  • Splunk

下面直接进入正题,直接开搞。

二、测试

测试环境:

操作系统: debian 10.12

CPU: Intel® Core™ i5-10400 CPU @ 2.90GHz

内存: 2 GB

InfluxDB v2.2.0

注:由于写入数据与生成查询等操作是与 influxdb 在同一台机器上,结果或许有偏差,可以自行使用两天机器进行测试。

  1. 安装 go 环境
add-apt-repository ppa:longsleep/golang-backports
apt-get update
apt-get install golang-1.15-go

# 如 go 无环境变量,则手动设置
# vim ~/.bashrc
# 添加 export PATH=$PATH:/usr/lib/go-1.15/bin
# source ~/.bashrc


# 设置代理 Go 1.13 及以上
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
  1. 安装 influxdb-comparisons
# 需要 go 语言环境,go version go1.15.9
go get github.com/influxdata/influxdb-comparisons/cmd/bulk_data_gen@latest github.com/influxdata/influxdb-comparisons/cmd/bulk_load_influx@latest

go get github.com/influxdata/influxdb-comparisons/cmd/bulk_query_gen@latest github.com/influxdata/influxdb-comparisons/cmd/query_benchmarker_influxdb@latest

# 需要将 /root/go/bin 加到环境变量,才能执行 bulk_data_gen、query_benchmarker_influxdb 等命令
# vim ~/.bashrc
# 添加 export PATH=$PATH:/root/go/bin
# source ~/.bashrc
  1. 生成数据

seconds_in_day = (24 hours in a day) * (60 minutes in an hour) * (60 seconds in a minute) = 86,400 seconds
epochs = seconds_in_day / 10 = 8,640
point_count = epochs * host_count * 9

So, for one host we get 8,640 * 1 * 9 = 77,760 points, and for 1,000 hosts we get 8,640 * 1000 * 9 = 77,760,000 points. Each simulated host produces nine measurements.

# 注意填写时间
bulk_data_gen -timestamp-start '2016-09-10T00:00:00Z' \
-timestamp-end '2016-09-10T00:00:09Z' \
-use-case devops -scale-var 1000 -sampling-interval 9s \
| influx write --org zxb_org --bucket bucket_1
# 生成后可能会报错 Error: failed to write data: 400 Bad Request: unable to parse 'dataset-size:311053,720013': missing tag value 忽略即可;

# 注意:如果需要删除数据,执行以下命令
influx delete --bucket bucket_1 \
  --start '1970-01-01T00:00:00Z' \
  --stop '2023-01-01T00:00:00Z'

命令参数解析:

bulk_data_gen 数据生成命令:

  • -sampling-interval 模拟数据生成时间间隔,默认 10s

  • -timestamp-start 生成数据的开始时间

  • -timestamp-end 生成数据的结束时间

  • -use-case 生成什么类型的数据,默认 devops(choices: devops, iot)

  • -format 生成数据的格式,默认 “influx-bulk” (choices: influx-bulk, es-bulk, cassandra, mongo, opentsdb)

  • -scale-var 在不同案例中特殊变量的个数,例如 iot 中的 home_id 个数,默认 1

influx 该命令为 influxDB 的写入命令,不作多解释。

  1. 查询数据,使用的是 HTTP 的方式去执行查询
# 生成查询,并执行查询
bulk_query_gen -db bucket_1 -queries 5 -use-case iot \
-timestamp-start '2022-05-10T00:00:00Z' -timestamp-end '2022-05-14T00:00:01Z' \
-use-case iot -query-type '1-home-12-hours' \
-format influx-flux-http | \
query_benchmarker_influxdb -urls http://localhost:8086 \
-token bHgEVZOX3evOE3LAzDjEU8iLLdTcl042iTGHSTWLdQX4m5sDg3yN99GMDtdIxhWWWWWBV2_mFC8buZRpMjVzLg== \
-organization 'zxb_org' -workers 5

命令参数解析:

bulk_query_gen 查询生成命令:

  • -db 在 v1 版本中为数据库名称,v2 为 bucket 名称,默认查询 “benchmark_db”

  • -use-case、-query-type、-format 这三个参数可以执行 bulk_query_gen -h 查看最下面的 use case matrix 对应填上去;例如以下图第一条为例子,-use-case 为 group-window-transpose-low-card,-query-type 为 last,-format 为 influx-flux-http

    image-20220513142847565

  • -queries 生成的查询数量,默认为 1000

  • -timestamp-start 生成数据的开始时间

  • -timestamp-end 生成数据的结束时间

query_benchmarker_influxdb 根据生成的查询,执行去查询,这样的基准测试才能更加轻量(免去了生成查询的时间)

  • -urls influxDB 的地址
  • -token 访问 token
  • -organization 组织名称
  • -workers 并发请求数量
写入测试:
数据发送速度(points/s)实际处理速度(points/s)平均 CPU 占用率(%)总耗时
1,0001,0001.54.716036ms
3,0003,00012.5474.297061ms
5,0005,00019.0854.339738ms
8,0006,00629.01.332948435s
10,0005,71438.751.752057124s
20,0004,43548.54.511424584s
5,00002,083见下图24.292371029s

下图(阴影部分)为当数据插入为 5W 条时的 CPU 占用曲线图,可见出现速度缓慢的原因 CPU 并不是瓶颈:

image-20220513164157536

三、总结

从测试结果可以知道,在单机的情况下,写入的速度还是可以接受的,CPU 占用率还未封顶,还可以有更好的写入速率。除了 influxdb-comparisons 工具外,还有 tsbs、influx-stress 可以进行测试,但它们并不支持 2.x,因此选择了 influxdb-comparisons 进行测试,中间也花了不少时间在看工具的介绍上面。

参考文档:

influxdb性能测试(arm64环境)

influxdb-comparisons

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
数据库基准和压力测试 2018版本 [Database Benchmarking and Stress Testing - 2018.pdf](https://itbooks.pipipan.com/fs/18113597-314044807) Database Benchmarking and Stress Testing pdf Provide evidence-based answers that can be measured and relied upon by your business. Database administrators will be able to make sound architectural decisions in a fast-changing landscape of virtualized servers and container-based solutions based on the empirical method presented in this book for answering “what if” questions about database performance. Today’s database administrators face numerous questions such as: What if we consolidate databases using multitenant features? What if we virtualize database servers as Docker containers? What if we deploy the latest in NVMe flash disks to speed up IO access? Do features such as compression, partitioning, and in-memory OLTP earn back their price? What if we move our databases to the cloud? As an administrator, do you know the answers or even how to test the assumptions? Database Benchmarking and Stress Testing introduces you to database benchmarking using industry-standard test suites such as the TCP series of benchmarks, which are the same benchmarks that vendors rely upon. You’ll learn to run these industry-standard benchmarks and collect results to use in answering questions about the performance impact of architectural changes, technology changes, and even down to the brand of database software. You’ll learn to measure performance and predict the specific impact of changes to your environment. You’ll know the limitations of the benchmarks and the crucial difference between benchmarking and workload capture/reply. This book teaches you how to create empirical evidence in support of business and technology decisions. It’s about not guessing when you should be measuring. Empirical testing is scientific testing that delivers measurable results. Begin with a hypothesis about the impact of a possible architecture or technology change. Then run the appropriate benchmarks to gather data and predict whether the change you’re exploring will be beneficial, and by what order of magnitude. Stop guessing. Start measuring. Let Database Benchmarking and Stress Testing show the way. What You’ll Learn Understand the industry-standard database benchmarks, and when each is best used Prepare for a database benchmarking effort so reliable results can be achieved Perform database benchmarking for consolidation, virtualization, and cloud projects Recognize and avoid common mistakes in benchmarking database performance Measure and interpret results in a rational, concise manner for reliable comparisons Choose and provide advice on benchmarking tools based on their pros and cons Who This Book Is For Database administrators and professionals responsible for advising on architectural decisions such as whether to use cloud-based services, whether to consolidate and containerize, and who must make recommendations on storage or any other technology that impacts database performance
查找最优惠的价格,更快,更轻松地获得价格比较。 Shop2Ship.com-从美国到您的包裹转寄! 产品简介:Shop2Ship-购物助手使用我们的Google Chrome浏览器扩展程序,可以找到最优惠的价格并立即获得价格比较! Shop2Ship-购物助手是一种新的在线购物方式。 不再浪费时间比较价格和错过交易–从来没有这么快和容易找到最佳价格。 让Shop2Ship-购物助手为您完成工作! ★在您购物时,我们将自动在广阔的在线购物领域中搜索,从而在数千种在线商店(如Amazon,Walmart,Best Buy,Home Depot,eBay等)中为数十亿种产品找到最优惠的价格。 ★我们也会跟踪所有产品的价格历史记录,使您随时了解情况,因此您始终会知道购买的最佳时间。 ★最后,为了使它变得更加简单,我们收集了所有的评分和评论,以便您唾手可得的关于产品的所有信息。 我们强大的AI引擎会在所有在线商店中搜索产品,为您提供完全独立且公正的信息。 只需点击一下,我们可能立即花费数小时。 Shop2Ship-Shopping Assistant完全免费,只需单击两次即可安装。 立即尝试,并确保每次在线购物都能找到最优惠的价格。 在结帐时将您的Shop2Ship USA包裹转发地址设置为目的地,然后我们会在世界任何地方将您的包裹重新寄给您! 来自美国的包裹转发是最经济的购物方式,现在有了Shop2Ship-Shopping Assistant,您将永远找到最优惠的价格! 安装扩展程序,即表示您同意Shop2Ship的条款和条件(https://shop2ship.com/google-chrome-extension-price-comparison)和隐私权政策(https://shop2ship.com/privacy-policy)。 支持语言:English
为了进行influxdb测试,你可以按照以下步骤进行操作: 1. 准备测试环境: 在两台服务器上进行测试,一台作为客户机,安装测试工具,另一台安装influxdb作为服务机。在服务机上安装influxdb可以通过以下步骤完成:首先,下载influxdb的安装包,可以使用以下命令进行下载: ``` wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.1.1-linux-arm64.tar.gz ``` 解压安装包: ``` tar xvzf influxdb2-2.1.1-linux-arm64.tar.gz ``` 将influxd移动到/usr/local/bin目录下: ``` mv influxdb2-2.1.1-linux-arm64/influxd /usr/local/bin/ ``` 2. 安装测试工具: influxdb官方提供了两款测试工具,influx-stress用于写入测试,influxdb-comparisons用于查询测试。你可以根据需要选择其中一个或者两个工具进行测试。 3. 进行测试: 在客户机上运行选择好的测试工具,对influxdb服务机进行压测。观察测试期间服务机的CPU、内存、网络IO和磁盘IO的消耗情况,并记录测试结果。你可以根据需要进行多次测试,以获取更准确的结果。 请注意,测试环境的配置对测试结果可能会产生影响。在测试之前,确保服务器的配置满足你的需求,并且按照测试工具的要求进行配置。 [2 [3<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [influxdb性能测试(arm64环境)](https://blog.csdn.net/toyangdon/article/details/122252174)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [InfluxDB 2.0 原理与应用实践](https://blog.csdn.net/hogwarts_ziqi/article/details/126000472)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值