go-bitswap icon indicating copy to clipboard operation
go-bitswap copied to clipboard

Improve (CPU) performance when rebroadcasting wants

Open Stebalien opened this issue 6 years ago • 1 comments

When we can't find anything for a while, we add all outstanding wants to a "broadcast" wantlist. Unfortunately, we repeatedly do this. Fortunately, we don't re-send "want" messages but repeatedly adding all idle wants to every peer's wantlist incurs a high CPU cost.

We've partially fixed this in #133 by doing this less frequently but we can do better.

  1. If it's already in the broadcast wantlist, don't bother "sending" the message.
  2. Only add new idle wants? Extra state we need to track but may be worth it.

Stebalien avatar Jul 05 '19 09:07 Stebalien

Can confirm that this is still an issue under heavy load.

Stebalien avatar Jul 17 '19 21:07 Stebalien