Skip to content

feat: congestion control for catchunks #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AnoldGH
Copy link

@AnoldGH AnoldGH commented Feb 21, 2025

Related to #97

Summary
This PR introduces congestion control mechanism for catchunks

Improvements

  • Commit 0e215a2 adds a general interface that supports multiple congestion window strategies, including fixed window, AIMD, and CUBIC
  • Commit 48afe7c refactors the existing codebase to add a retransmission queue for better congestion control

Pending Changes/Additions

  • TryStore as in ac07cca
  • Argument parsing for congestion window parameters (need to change Client APIs)

@AnoldGH AnoldGH force-pushed the congestion branch 2 times, most recently from bc237b7 to 48afe7c Compare February 28, 2025 23:56
Introduce "std/object/congestion" subpackage providing a
	unified interface for windowed congestion control and three
	window strategies: fixed, AIMD, and CUBIC

Introduce a basic interface for RTT estimators
@AnoldGH AnoldGH marked this pull request as ready for review March 1, 2025 00:18
@zjkmxy zjkmxy requested a review from Copilot April 16, 2025 07:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a congestion control mechanism for catchunks by adding multiple congestion window strategies and integrating a retransmission queue. Key changes include:

  • Adding a new RTTEstimator interface for RTT measurement.
  • Implementing three congestion window strategies: Fixed, AIMD, and CUBIC.
  • Refactoring the client consumer to leverage the new congestion control mechanism with retransmission queue support.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
std/object/congestion/rtt_estimator.go Adds the RTTEstimator interface for RTT estimation.
std/object/congestion/congestion_window_fixed.go Introduces a fixed congestion window implementation.
std/object/congestion/congestion_window_cubic.go Implements the CUBIC congestion window strategy with updates.
std/object/congestion/congestion_window_aimd.go Implements the AIMD congestion control mechanism.
std/object/congestion/congestion_window.go Provides the generic CongestionWindow interface.
std/object/client_consume_seg.go Refactors client consumption logic to use congestion control.

rtt = (*cw.rttEstimator).EstimatedRTT().Seconds() // estimated RTT
}

t := time.Since(cw.lastDecrease).Abs().Seconds() // time since last decrease
Copy link
Preview

Copilot AI Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of the Abs() method on time.Duration is non-standard as the Go standard library does not provide an Abs() method for time.Duration. Consider implementing a manual absolute value computation to prevent potential issues with negative durations.

Suggested change
t := time.Since(cw.lastDecrease).Abs().Seconds() // time since last decrease
duration := time.Since(cw.lastDecrease)
if duration < 0 {
duration = -duration
}
t := duration.Seconds() // time since last decrease

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow this is amazing

Copy link
Author

@AnoldGH AnoldGH Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abs() was added in go 1.19: https://pkg.go.dev/time#Duration.Abs

It is really cool though, didn't realize copilot has these nice interfaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants