fix(core): fix outbound bandwidth limiter token refill and metrics baseline
Outbound baseline bandwidth is configured as networkBaselineBandwidth * 5, but refillToken and metrics calculation were still using inbound baseline.
This caused dashboard outbound available bandwidth to always show negative values.
The negative values are caused by actual network exhaustion.
networkBaselineBandwidth * 5 is the max token size for the network bursting.
The metrics mean that the available bandwidth = network baseline - network consumption rate
In our actual production scenarios, outbound traffic is often larger than inbound traffic; for example, it's common for multiple groups to consume the same topic. Therefore, the baseline bandwidth of the outbound traffic should be adjusted to be larger than the baseline bandwidth of the inbound traffic. Otherwise, this metric will always be negative, making it difficult to determine the actual outbound bandwidth.
In our actual production scenarios, outbound traffic is often larger than inbound traffic; for example, it's common for multiple groups to consume the same topic. Therefore, the baseline bandwidth of the outbound traffic should be adjusted to be larger than the baseline bandwidth of the inbound traffic. Otherwise, this metric will always be negative, making it difficult to determine the actual outbound bandwidth.
In AWS / GCP / Azure, the inbound network and the outbound network are isolated. So setting the same baseline of the inbound network and outbound network is fine.
Is your environment's network shared by both inbound and outbound?
Um, we are using it in a self-built data center, where the bandwidth is relatively sufficient. The outbound traffic is many times that of the inbound traffic. We would like to set different baseline bandwidths for the inbound and outbound traffic. Do you have any good suggestions for modification?
Um, we are using it in a self-built data center, where the bandwidth is relatively sufficient. The outbound traffic is many times that of the inbound traffic. We would like to set different baseline bandwidths for the inbound and outbound traffic. Do you have any good suggestions for modification?
If the inbound and outbound traffic in a self-built data center share the same bandwidth, perhaps we should create an AsyncNetworkBandwidthLimiter that is shared by both inbound and outbound traffic.
My idea is to keep the peak value of out as baseline * 5, and to differentiate the baseline of out from that of in. For example, out could be baseline * 2 (this 2 is a coefficient, the default is 1, and it would be best if it were configurable).