-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the performance of LimitSequenceByteSize (#3548)
* Fix the performance of LimitSequenceByteSize I changed this function recently (#3483) as it was previously incorrectly not limiting the byte sequence in all cases Unfortunately this change caused the complexity of the function to go from O(n) -> O(n^2), where n is the number of sequence.Events This PR changes the complexity back to O(n) while still keeping the correct limit check We now estimate the byte overhead added by the Event slice using the constant `sequenceEventListSizeBytes` - which is a very conservative estimate - This does mean the function is now less useful for very small limits, but that isn't a problem for us in practice. Typically we limit to 4Mb, so 100 byte overhead is insignificant This change means the time to process an EventSequence with 170k events (approximately our worst case when using a 4Mb limit) from 3m10s -> 22.5ms (on my AWS machine) The motivation for this change was that large events going through our system were causing significant pauses in process - This impacted the scheduler and ingesters, causing widespread dispruption on large events (cancel/repioritize) Signed-off-by: JamesMurkin <jamesmurkin@hotmail.com> * Fix comment Signed-off-by: JamesMurkin <jamesmurkin@hotmail.com> * Rename constant + better comment Signed-off-by: JamesMurkin <jamesmurkin@hotmail.com> --------- Signed-off-by: JamesMurkin <jamesmurkin@hotmail.com>
- Loading branch information
1 parent
cf292c0
commit 18c29e1
Showing
2 changed files
with
60 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters