Bitswap client CPU hotspots
Goals
Under heavy load, we're seeing high CPU usage in Lassie originating in Bitswap. Looks like a couple functions are pretty heavy CPU consumers:
-
SessionInterestManager.RemoveSession -
MessageQueue.ExtractOutgoingMessage(andWantlist.Entrieswithin it) This pushes us towards 700%+ CPU usage on a Saturn node that affects overall performance.
Pprof visualization:
Source data:
cpu.pprof.zip
Lassie binaries (this is from the x86_64 build we think):
https://github.com/filecoin-project/lassie/releases/tag/v0.9.2
I suspect these hotspots are pretty common to heavy bitswap client usage and are worth optimizing.
Obviously not good to have these hotspots. Unless these are blocking anyone right now, I'm not planning for us to do them as part of the current Kubo/Boxo "0.21 iteration" given the other tasks we already have assigned. I am noting it for larger "bitswap overhaul" work that we want to sink into later in the year.