Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

reduce session contention #188

Merged
merged 3 commits into from
Aug 28, 2019
Merged

reduce session contention #188

merged 3 commits into from
Aug 28, 2019

Conversation

Stebalien
Copy link
Member

(and fix a small leak)

  1. Use a rw lock around the session list when updating sessions.
  2. Buffer session updates. We just need these to be delivered in-order, not
    synchronously. Note: we could use the interface patter used elsewhere in this
    library but I'm a bit worried about allocations.

@Stebalien Stebalien requested a review from dirkmc August 27, 2019 22:01
@Stebalien
Copy link
Member Author

@dirkmc I think this change is fine but please double-check. I noticed quite a bit of lock contention in 0.4.22 (ipfs/kubo#6564 (comment)). This may have already been fixed by fixing the interest stuff but I figured we could improve it a bit.

Copy link
Contributor

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

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

This looks like it will help to me 👍

We're not using these synchronously so we can buffer them a bit to avoid
blocking quite as much.

This also combines all incoming channels into a single one to ensure all
operations are processed in-order. This might be overkill bit it makes reasoning
about this a bit simpler.
@Stebalien Stebalien merged commit 565aa56 into master Aug 28, 2019
@Stebalien Stebalien deleted the fix/optimize branch August 28, 2019 01:50
Jorropo pushed a commit to Jorropo/go-libipfs that referenced this pull request Jan 26, 2023
reduce session contention

This commit was moved from ipfs/go-bitswap@565aa56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants