Announcing IFQL v0.0.3

Originally published at: https://www.influxdata.com/blog/announcing-ifql-v0-0-3/

The IFQL team releases a new version every two weeks. We want to get our changes into the hands of our community quickly so we can hear of your experiences early. Please submit issues and PRs on the repo. Check out the IFQL release announcement for details on the vision behind IFQL.

These last two weeks we have focused on performance and resource management (i.e. managing CPU and memory resources so that a single query cannot overwhelm the IFQL process).

Benchmarking

We have put together benchmarks comparing IFQL to InfluxQL. These benchmarks have been put in place early so that we can ensure going forward in continuing to maintain strong performance. Here are some initial charts showing where IFQL is compared to equivalent InfluxQL queries.

Five representative queries have been run on both systems1. To see details of the benchmarks, check out the PR.

Here are the five queries:

Query #1

IFQL - from(db:"db").range(start:2017-11-01T00:00:00Z, stop:2017-11-02T00:00:00Z).filter(exp:{"_measurement" == "m0" and "_field" == "v0" and $ > 0}).sum()
InfluxQL - SELECT sum(v0) FROM m0 WHERE time >= 2017-11-01T00:00:00Z AND time < 2017-11-02T00:00:00Z AND v0 > 0 GROUP BY *

Query #2

IFQL - from(db:"db").range(start:2017-11-01T00:00:00Z, stop:2017-11-05T00:00:00Z).filter(exp:{"_measurement" == "m0" and "_field" == "v0" and $ > 0}).sum()
InfluxQL - SELECT sum(v0) FROM m0 WHERE time >= 2017-11-01T00:00:00Z AND time < 2017-11-05T00:00:00Z AND v0 > 0 GROUP BY *

Query #3

IFQL - from(db:"db").range(start:2017-11-01T00:00:00Z, stop:2017-11-05T00:00:00Z).filter(exp:{"_measurement" == "m0" and "_field" == "v0" and $ > 0}).group(by:["tag0"]).sum()
InfluxQL - SELECT sum(v0) FROM m0 WHERE time >= 2017-11-01T00:00:00Z AND time < 2017-11-05T00:00:00Z AND v0 > 0 GROUP BY tag0

Query #4

IFQL - from(db:"db").range(start:2017-11-01T00:00:00Z, stop:2017-11-13T00:00:00Z).filter(exp:{"_measurement" == "m0" and "_field" == "v0" and $ > 0}).sum()
InfluxQL - SELECT sum(v0) FROM m0 WHERE time >= 2017-11-01T00:00:00Z AND time < 2017-11-13T00:00:00Z AND v0 > 0 GROUP BY *

Query #5

IFQL - from(db:"db").range(start:2017-11-01T00:00:00Z, stop:2017-11-13T00:00:00Z).filter(exp:{"_measurement" == "m0" and "_field" == "v0" and $ > 0}).group(by:["tag0"]).sum()
InfluxQL - SELECT sum(v0) FROM m0 WHERE time >= 2017-11-01T00:00:00Z AND time < 2017-11-13T00:00:00Z AND v0 > 0 GROUP BY tag0

First, let’s look at execution time as that is most important when considering the performance of a query engine.

For most queries, IFQL is already faster than InfluxQL. Note query #4 did not complete using InfluxQL and so has no time. We have an issue open already that should improve query #5.

Next examining the heap usage of the processes, we can see that IFQL is significantly more efficient in its usage.

The heap usage of both ifql processes barely registers in comparison to the heap usage of InfluxQL. Note, there are two ifql processes, ifqld which can be any number of sidecar processes, and influxd running with the new IFQL API enabled.

Resource Management

With version v0.0.3 it is now possible to limit the resources a query consumes. Our goal is to ensure that primarily a really hungry query can't crash the process and secondarily the hungry query will fairly share resources with other concurrent queries according to its priority.

Now with these limits in place a bad query that tries to consume too much memory is killed and an appropriate error is returned, instead of allowing the query to crash the process.

We also ran tests comparing v0.0.2 with v0.0.3. The test submitted more queries than the processes had resources. We then compared the execution times of the queries and could see that v0.0.3 reduced the overall execution time by 15%. This is accomplished by queuing and scheduling the work instead of letting all the queries concurrently fight over resources. The long tail latencies increase in v0.0.3 because of the queueing, but we have a plan to solve that issue later.

Overall v0.0.3 is a solid iterative release, and we will see you again in two weeks with another release. For a complete list of all changes see the CHANGELOG.

Footnotes:

[1] Note that InfluxDB master now has a Prometheus "/metrics" endpoint we used to collect these stats. We also used a new tool ingen to create the test datasets.

 

There are any plans to use IFQL in grafana?

Yes, the Grafana team is following our progress. We are working closely with them to ensure good support in the future.