btrask / stronglink

A searchable, syncable, content-addressable notetaking system
Other
1.04k stars 39 forks source link

Slow queries run forever instead of timing out #61

Open btrask opened 9 years ago

btrask commented 9 years ago

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

btrask commented 8 years ago

There are basically two ways to do this:

  1. By applying a cost factor to every step the filter does internally
  2. 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.