Skip to content

Conversation

@gacevicljubisa
Copy link
Member

@gacevicljubisa gacevicljubisa commented Jul 24, 2025

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Improves making sample time for redistribution game from 15-30% on bee-light-testnet.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@gacevicljubisa gacevicljubisa marked this pull request as ready for review July 25, 2025 17:25
@gacevicljubisa
Copy link
Member Author

gacevicljubisa commented Jul 25, 2025

The metrics show a clear improvement when comparing the first and last batch of data. Using buffered channels reduces processing time by up to 30%. Additionally, sampling time is mostly concentrated at the lower bound, suggesting that the time reduction could exceed 30%.

image

Testing was done on bee-light-testnet


chunkC := make(chan *reserve.ChunkBinItem)
workers := max(4, runtime.NumCPU())
chunkC := make(chan *reserve.ChunkBinItem, 3*workers)
Copy link
Contributor

Choose a reason for hiding this comment

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

the value 3 and then 3*workers were chosen after some testing and benchmarking? How did you choose to use these?

Copy link
Member Author

Choose a reason for hiding this comment

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

The main reason is to prevent workers from waiting for tasks. It decouples the producer (finding chunks) from the consumers (the workers), allowing it to queue up just enough work to ensure the workers are always busy. I will try to repeat the tests with greater values to double check. But this seems good enough for current logic.

@gacevicljubisa gacevicljubisa merged commit 866b4b7 into master Jul 29, 2025
25 of 29 checks passed
@gacevicljubisa gacevicljubisa deleted the sample-buf-chan branch July 29, 2025 11:47
@nugaon nugaon linked an issue Jul 29, 2025 that may be closed by this pull request
@gacevicljubisa gacevicljubisa linked an issue Jul 30, 2025 that may be closed by this pull request
@bcsorvasi bcsorvasi added this to the v2.7.0 milestone Oct 8, 2025
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.

Optimize ReserveSample Function Transactions not sent in the right phase of the round

7 participants