Performance issue
moisesdelacruz opened this issue · 3 comments
moisesdelacruz commented
Hello,
I just did tests with InfluxQL in cURL in terminal, and it works very fast (milliseconds), now the same query takes up to 19 seconds in influxdb-rust.
Any idea what the problem may be?
- Rust Version: rustc 1.50.0 (cb75ad5db 2021-02-10)
- Runtime version (e.g. Tokio): 0.2.22
- OS Version: MacOS 10.14.6
Steps to Reproduce:
#[tokio::main]
async fn main() {
// Connect to db `test` on `http://localhost:8086`
let client = Client::new("https://influxdb-host", "example_db")
.with_token("jwt");
// Let's see if the data we wrote is there
let read_query = Query::raw_read_query("SELECT * FROM example_db.example_rp.history WHERE tag='example'");
let start = Time::now();
let result = client
.query(&read_query)
.await;
let end = Time::now();
println!("{}", result.unwrap());
println!("{:?}", end - start); // Duration { seconds: 16, nanoseconds: 823561000 }
}
VS
curl --get https://influxdb-host/query?db=example_db \
--header "Authorization: Token jwt" \
--data-urlencode "q=SELECT * FROM example_db.example_rp.history WHERE tag='example'"
# took miliseconds
moisesdelacruz commented
In this case it is bringing a month of data, where in every second there is at least one record.
msrd0 commented
@moisesdelacruz Can you confirm that you ran these tests in release mode? Rust in debug mode can be pretty slow
Empty2k12 commented
@moisesdelacruz has this been resolved? I am closing now and will reopen once you confirm it's an issue with this crate.