quickwit-oss / quickwit

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

Cap search RAM Usage #5355

Open fulmicoton opened 2 weeks ago

fulmicoton commented 2 weeks ago

All of the data required to run a single split leaf search needs to sit in RAM for a few hundred ms. Right now we can limit Searcher RAM usage by limiting search concurrency.

However, the amount of RAM necessary to run a split search is difficult to foresee and it can vary a lot. Also limiting search concurrency can strongly impact search latency.

We also expose ourselves to "Query of death" phenomenons.

Capping memory is non-trivial... If we just used a semaphore for instance, we would expose ourselves to a possible deadlock.

We need a best-effort solution to cap the search RAM usage.

fulmicoton commented 2 weeks ago

We could do something like:

With this solution, as long as a split requires less than 100mb, no problem happens. Only pathological search request (taking more than 100mb per split) may fail.