Attempt to reduce disruption due to probe. (#1839)

* Make congestion controller probe config

* Wait for enough estimate samples

* fixes

* format

* limit number of times a packet is ACKed

* ramp up probe duration

* go format

* correct comment

* restore default

* add float64 type to generated CLI
This commit is contained in:
Raja Subramanian authored and GitHub committed 2023-06-30 11:09:46 +05:30
1 parent 3de1e49165
commit 69a1e572be
7 files changed
+192 -102

No files matched your search

+24 -17
View File
@@ -2,7 +2,6 @@ package streamallocator
import (
"fmt"
"math"
"sort"
"sync"
"time"
@@ -199,6 +198,7 @@ func NewStreamAllocator(params StreamAllocatorParams) *StreamAllocator {
}
s.probeController = NewProbeController(ProbeControllerParams{
Config: s.params.Config.ProbeConfig,
Prober: s.prober,
Logger: params.Logger,
})
@@ -555,7 +555,7 @@ func (s *StreamAllocator) processEvents() {
}
func (s *StreamAllocator) ping() {
ticker := time.NewTicker(500 * time.Millisecond)
ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop()
for {
@@ -641,9 +641,14 @@ func (s *StreamAllocator) handleSignalEstimate(event *Event) {
func (s *StreamAllocator) handleSignalPeriodicPing(event *Event) {
// finalize probe if necessary
isHandled, isSuccessful := s.probeController.MaybeFinalizeProbe()
trend, _ := s.channelObserver.GetTrend()
isHandled, isNotFailing, isGoalReached := s.probeController.MaybeFinalizeProbe(
s.channelObserver.HasEnoughEstimateSamples(),
trend,
s.channelObserver.GetLowestEstimate(),
)
if isHandled {
s.onProbeDone(isSuccessful)
s.onProbeDone(isNotFailing, isGoalReached)
}
// probe if necessary and timing is right
@@ -677,10 +682,7 @@ func (s *StreamAllocator) handleSignalSendProbe(event *Event) {
func (s *StreamAllocator) handleSignalProbeClusterDone(event *Event) {
info, _ := event.Data.(ProbeClusterInfo)
isHandled := s.probeController.ProbeClusterDone(info, int64(math.Min(float64(s.committedChannelCapacity), float64(s.channelObserver.GetLowestEstimate()))))
if isHandled {
s.onProbeDone(true)
}
s.probeController.ProbeClusterDone(info)
}
func (s *StreamAllocator) handleSignalResume(event *Event) {
@@ -925,7 +927,7 @@ func (s *StreamAllocator) allocateTrack(track *Track) {
s.adjustState()
}
func (s *StreamAllocator) onProbeDone(isSuccessful bool) {
func (s *StreamAllocator) onProbeDone(isNotFailing bool, isGoalReached bool) {
highestEstimateInProbe := s.channelObserver.GetHighestEstimate()
//
@@ -939,18 +941,23 @@ func (s *StreamAllocator) onProbeDone(isSuccessful bool) {
// NOTE: With TWCC, it is possible to reset bandwidth estimation to clean state as
// the send side is in full control of bandwidth estimation.
//
channelObserverString := s.channelObserver.ToString()
s.channelObserver = s.newChannelObserverNonProbe()
if !isSuccessful {
s.params.Logger.Infow(
"probe done",
"isNotFailing", isNotFailing,
"isGoalReached", isGoalReached,
"committedEstimate", s.committedChannelCapacity,
"highestEstimate", highestEstimateInProbe,
"channel", channelObserverString,
)
if !isNotFailing {
return
}
// probe estimate is same or higher, commit it and try to allocate deficient tracks
s.params.Logger.Infow(
"successful probe, updating channel capacity",
"old(bps)", s.committedChannelCapacity,
"new(bps)", highestEstimateInProbe,
)
s.committedChannelCapacity = highestEstimateInProbe
if highestEstimateInProbe > s.committedChannelCapacity {
s.committedChannelCapacity = highestEstimateInProbe
}
s.maybeBoostDeficientTracks()
}