Skip to content
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(bloom): store running aggregate in memory #2367

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

sistemd
Copy link
Contributor

@sistemd sistemd commented Nov 12, 2024

Closes #2354.
Closes #2355.

@sistemd sistemd requested a review from a team as a code owner November 12, 2024 14:23
Copy link
Contributor

@kkovaacs kkovaacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

BTW, do you have some rough estimates on how long reconstructing the running aggregate will take when starting up pathfinder?

@sistemd
Copy link
Contributor Author

sistemd commented Nov 13, 2024

Looks great, thanks!

BTW, do you have some rough estimates on how long reconstructing the running aggregate will take when starting up pathfinder?

Yeah, it seems to slow down our startup time by a few seconds on average. If that's too much, a good middle ground might be to store the running aggregate filter, but do it less often than the filter's entire range. In other words: aggregate filters cover 32k blocks each, and we can store the running aggregate filter for example after every 8k or 4k blocks. This is a middle ground between the approach implemented by this PR and the approach which was in place previously (and actually thinking about it, this might be really easy to implement).

I'll let you know exactly how long the reconstruction takes in the worst possible case (when 32k - 1 blocks need to be reconstructed).

@kkovaacs
Copy link
Contributor

Yeah, it seems to slow down our startup time by a few seconds on average. If that's too much, a good middle ground might be to store the running aggregate filter, but do it less often than the filter's entire range. In other words: aggregate filters cover 32k blocks each, and we can store the running aggregate filter for example after every 8k or 4k blocks. This is a middle ground between the approach implemented by this PR and the approach which was in place previously (and actually thinking about it, this might be really easy to implement).

I'll let you know exactly how long the reconstruction takes in the worst possible case (when 32k - 1 blocks need to be reconstructed).

I think a few seconds should be totally fine.

Comment on lines +608 to +614
let running_aggregate = match self.running_aggregate.lock() {
Ok(guard) => guard,
Err(poisoned) => {
tracing::error!("Poisoned lock in load_aggregate_bloom_range");
poisoned.into_inner()
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a uniform way of locking mutexes in the code and it's high time we had one. 🤔

@sistemd sistemd force-pushed the sistemd/running-aggregate-in-memory branch from 1a3205d to 6f74d53 Compare November 14, 2024 16:24
@sistemd sistemd merged commit 0f6654a into main Nov 14, 2024
7 checks passed
@sistemd sistemd deleted the sistemd/running-aggregate-in-memory branch November 14, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants