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

cleanup: remove redundant session counter from db #4159

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

joschisan
Copy link
Contributor

No description provided.

@elsirion
Copy link
Contributor

From our call: make revert of 62b6df4 more explicit and split the PR into two commits.

.await
.map(|entry| (entry.0 .0) + 1)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.map(|entry| (entry.0 .0) + 1)
.map(|entry| (entry.0.0) + 1)

that space really messed up my brain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but cargo fmt insists on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

While better than counting, I think the underlying implementation will race ahead and start reading more than just one key, making this call actually generate a heavier IO load than expected.

Copy link
Contributor

Choose a reason for hiding this comment

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

Rocksdb should be caching pages that have been recently written to. This entry is written every session (~5mins) right? Hard to know the actual IO cost without benchmarking it at all but if its significant IO that would be surprising to me

Copy link
Contributor

Choose a reason for hiding this comment

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

I would slap in-memory cache on top of the whole thing, so this code doesn't even need to do any IO except a first time each session.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's see how it behaves.

@@ -744,8 +734,11 @@ impl ConsensusServer {
}

pub(crate) async fn get_finished_session_count_static(dbtx: &mut DatabaseTransaction<'_>) -> u64 {
dbtx.get_value(&SignedSessionOutcomeCountKey)
dbtx.find_by_prefix_sorted_descending(&SignedSessionOutcomePrefix)
Copy link
Member

Choose a reason for hiding this comment

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

make sure to measure it

Copy link
Contributor

Choose a reason for hiding this comment

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

Even if it responds here fast, it might have a higher underlying cost which will be hard to measure here. (see other comment).

Copy link

codecov bot commented Jan 29, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (df4bd8e) 58.01% compared to head (bb55c8d) 58.07%.

Files Patch % Lines
fedimint-server/src/consensus/server.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4159      +/-   ##
==========================================
+ Coverage   58.01%   58.07%   +0.05%     
==========================================
  Files         192      192              
  Lines       42990    42958      -32     
==========================================
+ Hits        24941    24946       +5     
+ Misses      18049    18012      -37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joschisan joschisan added this pull request to the merge queue Jan 30, 2024
Merged via the queue into fedimint:master with commit 02f4ce0 Jan 30, 2024
20 of 21 checks passed
@joschisan joschisan deleted the count branch January 30, 2024 18:46
@justinmoon
Copy link
Contributor

@elsirion We need to figure out how to backport this

@elsirion
Copy link
Contributor

elsirion commented Feb 1, 2024

@elsirion We need to figure out how to backport this

Opened #4203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants