【发布时间】:2021-04-27 19:04:33
【问题描述】:
我是 InfluxDB 的新手,我正在尝试比较 MariaDB 和 InfluxDB 2.0 的性能。因此,我对存储在 txt 文件 (30mb) 中的大约 350.000 行进行了基准测试。
在使用 MariaDB 时,我使用“executemany”将多行写入数据库,所有行大约需要 20 秒(使用 Python)。
所以,我使用 Python 客户端对 InfluxDB 进行了同样的尝试,附上我的主要步骤。
#Configuring the write api
write_api = client.write_api(write_options=WriteOptions(batch_size=10_000, flush_interval=5_000))
#Creating the Point
p = Point(“Test”).field(“column_1”,value_1).field(“column_2”,value_2) #having 7 fields in total
#Appending the point to create a list
data.append(p)
#Then writing the data as a whole into the database, I do this after collecting 200.000 points (this had the best performance), then I clean the variable “data” to start again
write_api.write(“bucket”, “org”, data)
执行此操作大约需要 40 秒,是 MariaDB 时间的两倍。
我被这个问题困扰了很长一段时间,因为文档建议我分批编写它,我这样做了,理论上它应该比 MariaDB 更快。
但可能我错过了什么
提前感谢您!
【问题讨论】:
标签: mariadb benchmarking influxdb influxdb-python