Log NACK information in stream allocator. (#1018)

This commit is contained in:
Raja Subramanian
2022-09-19 14:33:16 +05:30
committed by GitHub
parent 924be2fbb7
commit 26e6024137
+11 -4
View File
@@ -676,11 +676,12 @@ func (s *StreamAllocator) handleNewEstimateInNonProbe() {
} }
var estimateToCommit int64 var estimateToCommit int64
var packets, repeatedNacks uint32
var nackRatio float64 var nackRatio float64
expectedBandwidthUsage := s.getExpectedBandwidthUsage() expectedBandwidthUsage := s.getExpectedBandwidthUsage()
switch reason { switch reason {
case ChannelCongestionReasonLoss: case ChannelCongestionReasonLoss:
nackRatio = s.channelObserver.GetNackRatio() packets, repeatedNacks, nackRatio = s.channelObserver.GetNackRatio()
estimateToCommit = int64(float64(expectedBandwidthUsage) * (1.0 - NackRatioAttenuator*nackRatio)) estimateToCommit = int64(float64(expectedBandwidthUsage) * (1.0 - NackRatioAttenuator*nackRatio))
default: default:
estimateToCommit = s.lastReceivedEstimate estimateToCommit = s.lastReceivedEstimate
@@ -693,6 +694,8 @@ func (s *StreamAllocator) handleNewEstimateInNonProbe() {
"new(bps)", estimateToCommit, "new(bps)", estimateToCommit,
"lastReceived(bps)", s.lastReceivedEstimate, "lastReceived(bps)", s.lastReceivedEstimate,
"expectedUsage(bps)", expectedBandwidthUsage, "expectedUsage(bps)", expectedBandwidthUsage,
"packets", packets,
"repeatedNacks", repeatedNacks,
"nackRatio", nackRatio, "nackRatio", nackRatio,
) )
s.committedChannelCapacity = estimateToCommit s.committedChannelCapacity = estimateToCommit
@@ -1591,7 +1594,7 @@ func (c *ChannelObserver) GetHighestEstimate() int64 {
return c.estimateTrend.GetHighest() return c.estimateTrend.GetHighest()
} }
func (c *ChannelObserver) GetNackRatio() float64 { func (c *ChannelObserver) GetNackRatio() (uint32, uint32, float64) {
ratio := 0.0 ratio := 0.0
if c.packets != 0 { if c.packets != 0 {
ratio = float64(c.repeatedNacks) / float64(c.packets) ratio = float64(c.repeatedNacks) / float64(c.packets)
@@ -1600,12 +1603,12 @@ func (c *ChannelObserver) GetNackRatio() float64 {
} }
} }
return ratio return c.packets, c.repeatedNacks, ratio
} }
func (c *ChannelObserver) GetTrend() (ChannelTrend, ChannelCongestionReason) { func (c *ChannelObserver) GetTrend() (ChannelTrend, ChannelCongestionReason) {
estimateDirection := c.estimateTrend.GetDirection() estimateDirection := c.estimateTrend.GetDirection()
nackRatio := c.GetNackRatio() packets, repeatedNacks, nackRatio := c.GetNackRatio()
switch { switch {
case estimateDirection == TrendDirectionDownward: case estimateDirection == TrendDirectionDownward:
@@ -1613,6 +1616,8 @@ func (c *ChannelObserver) GetTrend() (ChannelTrend, ChannelCongestionReason) {
"channel observer: estimate is trending downward", "channel observer: estimate is trending downward",
"name", c.params.Name, "name", c.params.Name,
"estimate", c.estimateTrend.ToString(), "estimate", c.estimateTrend.ToString(),
"packets", packets,
"repeatedNacks", repeatedNacks,
"ratio", nackRatio, "ratio", nackRatio,
) )
return ChannelTrendCongesting, ChannelCongestionReasonEstimate return ChannelTrendCongesting, ChannelCongestionReasonEstimate
@@ -1621,6 +1626,8 @@ func (c *ChannelObserver) GetTrend() (ChannelTrend, ChannelCongestionReason) {
"channel observer: high rate of repeated NACKs", "channel observer: high rate of repeated NACKs",
"name", c.params.Name, "name", c.params.Name,
"estimate", c.estimateTrend.ToString(), "estimate", c.estimateTrend.ToString(),
"packets", packets,
"repeatedNacks", repeatedNacks,
"ratio", nackRatio, "ratio", nackRatio,
) )
return ChannelTrendCongesting, ChannelCongestionReasonLoss return ChannelTrendCongesting, ChannelCongestionReasonLoss