dariusc93 / rust-ipfs

The InterPlanetary File System (IPFS), implemented in Rust.
Apache License 2.0
39 stars 7 forks source link

bitswap: Investigate performance speed #123

Open dariusc93 opened 9 months ago

dariusc93 commented 9 months ago

Bitswap (or beetle-bitswap) speed is rather low compared to kubo (and possibly js-ipfs/helia) when exchanging blocks between two rust-ipfs nodes, however the speed is much faster when exchanging blocks with a kubo node. Originally, it could have been due to how we process blocks in IpfsTask, however since a kubo node bitswap performance is much faster between rust-ipfs<->kubo, this may be more related to how blocks are sent out in the current implementation or requested from kubo.

Information (base on 256mb file in local network): rust-ipfs<->rust-ipfs: ~103s kubo<->rust-ipfs: ~9s rust-ipfs<->kubo: ~38s

dariusc93 commented 4 months ago

With the internal bitswap implementation, the transfer is much faster, however that is only if rust-ipfs is requesting the block(s). If kubo is requesting the blocks, it takes longer to transfer. While debugging, it may be that kubo is hitting its internal timeout causing it to wait despite receiving the HAVE response. Not sure if this is a bug with go variant of bitswap or the way we handle passing messages (this havent been tested with beetle-bitswap or js-ipfs/helia bitswap). Might be solvable with #210 if its an issue with how we handle messages.

Note: