stronglink
stronglink copied to clipboard
Slow queries run forever instead of timing out
Currently we don't impose any timeout on slow queries. This can easily lead to saturating the thread pool and causing a denial of service.
This is a little bit more difficult because for trusted applications we don't want to impose timeouts. Either we need to add a special user permission for long-running queries, or else we need to figure out a compromise. Possibly preempting slow queries or something.
Obviously it'd be nice to simply speed up slow queries too. #22
There are basically two ways to do this:
- By applying a cost factor to every step the filter does internally
- By setting a timer
I'm not sure which one is better. By counting steps, the result would be deterministic and unaffected by other processes or random slowdowns. On the other hand the timer might be more accurate/adaptive, for example if the whole system is running slow then we should probably terminate earlier.