-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solution] Threshold rule performance fixes #113587
Comments
Pinging @elastic/security-solution (Team: SecuritySolution) |
@peluja1012 @banderror can you please add this bug to a project (if needed), add an impact and remove the triage label? Thanks! |
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
From the above, the only thing that is really affected by increasing the max number of aggregation fields is the average query time. The current max (3) results in a maximum query time of 4.5 seconds. This increases to 6 seconds when 4 fields are used, and goes up to about 8 seconds for 5 and 10 fields. Index time is not affected. Tests were run using a modified version of |
The query time increases almost linearly for lower values of threshold fields, but this affect appears to attenuate over time, as the query time for both 5 and 10 threshold fields is nearly identical. This shows that there will be a cost associated with increasing the number of allowed threshold fields, but if we DO wish to increase it, perhaps we shouldn't limit the value at all. |
@madirey is it possible to get numbers for a |
That said, our current implementation (nested terms) is limited in that we can only get 10k (max is 65k, so we could bump this up) top-level buckets. Which means we could get significantly less than that after the cardinality of the child buckets are multiplied in. We mitigate this by sorting the buckets by cardinality (desc), but this could still result in false negatives. The advantage of |
The optimization mentioned above actually increased the rule runtime by about 3x. So far, it looks like nested |
There are 2 known issues which can impact performance of a threshold rule over large indices. I've outlined some steps below that should be addressed ASAP:
fields
in Thresholdtop_hits
aggregation to only include necessary fields (or none at all if we can get away with it)terms
agg in rule configuration... this will always result in a cardinality of1
which is not useful, and thus wastefulInitialize(I think the default value ofshard_min_doc_count
appropriately0
may be appropriate here... will review further)multi_terms
andcomposite
instead of nestedterms
aggs ([Security Solution][Alerts] Explore using multi_terms or composite aggs for threshold rules #125703)The text was updated successfully, but these errors were encountered: