Influx 2.0 OSS -> how to improve query performance?

I ran the latest Graphite and Influx 2.0 OSS docker images on the same machine, with 2 metrics both for 7 days @ 1 second resoltution (604800 samples). Quering 7 days with a mean aggregation window of 10minutes, Graphite delivers results in 1.3 seconds, Influx: 6.7sec.
Is this slowness excpected, or am I missing a configuration somewhere?

P.S. For reference, on the same machine, loading the same 7d/1s dataset as pandas df from pickle, resampling to 10min, and plotting takes 0.17 seconds.

Flux Query:
from(bucket: “main”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: ® => r["_measurement"] == “foo”)
|> filter(fn: ® => r["_field"] == “bar”)
|> aggregateWindow(every: v.windowPeriod, fn: mean)
|> yield(name: “mean”)

I think the beta is still largely a work in progress, it says it’s not meant for performance testing just yet - but it’s still worth seeing if it can be improved.

A few searches just now didn’t bring up any profiling tools, but hopefully one of the staff will pop in to advise if that’s possible. In the interim are you able to tell if performance is scaling linearly with the measurement’s raw datapoint count, or the query duration? At a guess it sounds like something under the hood is not being cached properly and is rebuilt with each group. If you can plot the trend you’re getting and provide a a dataset , i wouldn’t mind have a play as well - tho I’ve only got a rpi4 to use at present.

Flux is still fairly early in development and mostly unoptimized (we know this and it was a conscious decision), but the Flux team is currently focused on optimizing the most common use cases. You will start the see the optimizations land in InfluxDB Cloud and InfluxDB OSS (2.0) in the next couple of weeks. aggregateWindow() is one of the operations that has been greatly improved, we’re just in the process of pressure-testing the optimizations.

In the mean time, keep your I on the Optimize queries guide. This will be updated once the new optimizations roll in.

1 Like