-
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
ref(store): Multithread the store using a rayon pool #3837
Conversation
@@ -59,8 +60,10 @@ impl Validator { | |||
.map(drop) | |||
} | |||
|
|||
fn get_schema(&mut self, topic: KafkaTopic) -> Result<Option<&SentrySchema>, SchemaError> { | |||
Ok(match self.schemas.entry(topic) { | |||
fn get_schema(&self, topic: KafkaTopic) -> Result<Option<Arc<SentrySchema>>, SchemaError> { |
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.
Returns an Arc
to keep the critical section short.
@@ -39,13 +40,13 @@ pub enum SchemaError { | |||
#[derive(Debug, Default)] | |||
pub struct Validator { | |||
/// Caches the schema for given topics. | |||
schemas: BTreeMap<KafkaTopic, Option<SentrySchema>>, | |||
schemas: Mutex<BTreeMap<KafkaTopic, Option<Arc<SentrySchema>>>>, |
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.
Required to make this and the producer Send
b812cfc
to
3940224
Compare
@@ -332,3 +329,67 @@ impl Producer { | |||
}) | |||
} | |||
} | |||
|
|||
struct Debounced { |
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.
Needed now because we need a Producer: Send
and the atomic impl is a bit more elaborate
3940224
to
8f610bb
Compare
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.
See question about WorkerGroup
.
Co-authored-by: Joris Bayer <joris.bayer@sentry.io>
Co-authored-by: Joris Bayer <joris.bayer@sentry.io>
We've seen the store is not being able to keep up if the processor gets parallelized too much. This switches the CPU heavy processing of the store to its own thread pool.
#skip-changelog