quickwit-oss / quickwit

Cloud-native search engine for observability. An open-source alternative to Datadog, Elasticsearch, Loki, and Tempo.
https://quickwit.io
Other
8.31k stars 339 forks source link

Prevents single split searches from different leaf_search from interleaving #5509

Closed fulmicoton closed 1 month ago

fulmicoton commented 1 month ago

Before this PR, we just used a semaphore to acquire a permit and start a new tokio task to run our single split search.

In pseudo code, a leaf_search would look like:

for split in splits {
    let permit = semaphore.acquire().await;
    tokio::spawn(async move {
       single_split_search(split);
       drop(permit)
    })
}

The problem with this is that it allows interleaving split search from one search request with another one.

This interleaving strongly impacts search latency. For instance, one can imagine two queries A and B with 3 splits each. Executing as follows | A | A | A | B | B | B | offers a much short latency for A than | A | B | B | A | B | A |

This PR also adds two metrics to monitor the number of queue single split search.

github-actions[bot] commented 1 month ago

On SSD:

Average search latency is 0.99x that of the reference (lower is better).
Ref run id: 3940, ref commit: 5e5b360ffba63e07ab9ff1b2735efb228d0c2520
Link

On GCS:

Average search latency is 1.02x that of the reference (lower is better).
Ref run id: 3941, ref commit: 5e5b360ffba63e07ab9ff1b2735efb228d0c2520
Link