Bitswap should use one stream per message

Đang mở
#765 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
go

Hướng nghiên cứu

Không có tệp mã nguồn, bài kiểm thử hay điểm vào nào được nêu tên. Hãy bắt đầu bằng cách lần theo mã xử lý vòng đời của thông điệp và stream Bitswap, sau đó xem xét ngữ cảnh buffering của Yamux được mô tả trong issue. Để được coi là hoàn tất, cần có một cách tiếp cận đã được thống nhất cho các stream theo từng thông điệp, việc dọn dẹp khi peer ngắt kết nối và mức độ bao phủ cho hành vi phát sinh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Go
Star
326
Fork
165
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ipfs/boxo

Tất cả issue của ipfs/boxo

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.