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

Improve performance by reducing signing state contention #244

Open
Tracked by #296
ChaoticTempest opened this issue Aug 7, 2023 · 0 comments
Open
Tracked by #296

Improve performance by reducing signing state contention #244

ChaoticTempest opened this issue Aug 7, 2023 · 0 comments
Assignees
Labels
Emerging Tech Emerging Tech flying formation at Pagoda Near BOS NEAR BOS team at Pagoda

Comments

@ChaoticTempest
Copy link
Member

Currently, SigningState is being held behind a RwLock, which can lead to contention when there are multiple operations going on (i.e. claim_oidc, reveal, signature_share). This can actually slow down another person's new_account request if there are multiple ones going on, where each are trying to acquire the write lock.

Our current SigningState looks like:
https://github.com/near/mpc-recovery/blob/29b64781969f944a4aa273d181d85689e156dc52/mpc-recovery/src/sign_node/aggregate_signer.rs#L21-L24

We need concurrent key insertions is the issue here, since we have multiple entry points for modifying the keys in each of the HashMaps. But before making this optimization, we should wait until #233 is complete to compare easily.

one simple speed up we can do is to internalize the RwLock, such that each HashMap has its own RwLock:

pub struct SigningState {
    committed: RwLock<HashMap<AggrCommitment, Committed>>,
    revealed: RwLock<HashMap<Reveal, Revealed>>,
}

@volovyks @itegulov @DavidM-D lmk what you guys think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Emerging Tech Emerging Tech flying formation at Pagoda Near BOS NEAR BOS team at Pagoda
Projects
Status: Backlog
Development

No branches or pull requests

2 participants