Bitswap should use one stream per message

オープン
#765 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
go

調査の方向性

ソースファイル、テスト、エントリポイントのいずれも指定されていません。まず Bitswap メッセージとストリームのライフサイクルコードを追跡し、次に issue で説明されている Yamux のバッファリングのコンテキストを確認してください。完了の条件は、メッセージごとのストリーム、peer の切断時のクリーンアップ、およびそれによって生じる動作のカバレッジについて、合意されたアプローチがあることです。

索引モデルが issue の本文から書いたものです。

説明

kind/discussion P3

We should consider changing bitswap to use one stream per message.

@MarcoPolo:

Ideally we'd use one stream per message and close the stream once we're done. I believe the reason we don't do that is that in Yamux the initial send buffer is constant per stream (rather than configurable both within a stream and per connection connection as in QUIC). This means that if our initial message is larger than that initial send capacity, then we have to wait for a round trip to send the whole message. By reusing the stream, the peer can increase our send buffer size in a later message.

It may be worth changing this in Yamux.

The real issue is that the cleanup of peer disconnects is slow. A lot of time is spent on acquiring the lock by many different goroutines.

The benefit of the one stream per message approach is that you avoid the whole issue of maintaining a reference and knowing if a connection is even alive or not.

@gammazero:

Seems worth it to having one stream per message. Reusing the stream is like double-muxing to avoid a buffer sizing issue. Being able to have different messages on the same connection is the point of muxing, and streams is the mechanism for doing that.

The initial yamux stream buffer size is 256Kib. If most of our messages are smaller, then no change to yamux is needed. I suspect we do need a larger buffer, particularly for block transfer. Seems like a change to yamux is worth it, unless the occasional extra round trip is not a significant problem.

主要言語
Go
スター
326
フォーク
165
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ipfs/boxo のほかの issue

ipfs/boxo の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。