-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat(spooler): Implement eviction algorithm for EnvelopeBuffer
#3932
Conversation
// elements from each popped stack. | ||
for lru_item in lru { | ||
if let Some(mut stack) = self.pop_stack(lru_item.0) { | ||
stack.evict().await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are using disk, it's not the most efficient thing to run a query for each project key pair but we can investigate the performance of this later on.
@@ -105,15 +106,18 @@ struct EnvelopeBuffer<P: StackProvider> { | |||
/// This indirection is needed because different stack implementations might need different | |||
/// initialization (e.g. a database connection). | |||
stack_provider: P, | |||
/// The maximum number of stacks that can be evicted when low on memory. | |||
max_evictable_stacks: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to have this defined as a percentage (since the buffer can grow a lot), but for now, we will remain with a static value.
EnvelopeBuffer
Closed in favor of #4014. |
This PR implements an eviction algorithm that can be triggered via the
evict
method call on theEnvelopeBuffer
. The eviction policy aims to evict all the envelope stacks that are not ready or have been stale for the longest time.The PR doesn't include the logic for triggering the eviction, since this is something that we can decide later on. Still, some possibilities include trying eviction via tickers that frequently monitor the capacity of Relay and evict data when in need.
Closes: https://github.com/getsentry/team-ingest/issues/518