erobot opened a new issue, #15229:
URL: https://github.com/apache/pulsar/issues/15229

   **Describe the bug**
   Nic speed unit conversion is wrong on linux. This makes reported bandwidth 
usage lower than actual. For example, setting 
loadBalancerOverrideBrokerNicSpeedGbps=10Gpbs and then nic max reported usage 
is (10\*pow(10,9)/8\*8/1024)/(10\*1024\*1024)=93%.
   
   Source: https://en.wikipedia.org/wiki/Bit_rate
   > 1,000 bit/s        = 1 [kbit/s](https://en.wikipedia.org/wiki/Kbit/s) (one 
[thousand](https://en.wikipedia.org/wiki/Thousand) bits per second)
   > 1,000,000 bit/s    = 1 [Mbit/s](https://en.wikipedia.org/wiki/Mbit/s) (one 
[million](https://en.wikipedia.org/wiki/Million) bits per second)
   > 1,000,000,000 bit/s        = 1 
[Gbit/s](https://en.wikipedia.org/wiki/Gbit/s) (one 
[billion](https://en.wikipedia.org/wiki/1000000000_(number)) bits per second)
   
   Current codes calculate 1Gbps as 1024*1024kbps, 1Mbit/s as 1024kbps and 
1024Byte/s as 8kbps:
   
https://github.com/apache/pulsar/blob/d7ddda811437096b857bffff7d080a1c555f54d8/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LinuxBrokerHostUsageImpl.java#L125-L130
   
https://github.com/apache/pulsar/blob/d7ddda811437096b857bffff7d080a1c555f54d8/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/LinuxInfoUtils.java#L245-L253
   
https://github.com/apache/pulsar/blob/d7ddda811437096b857bffff7d080a1c555f54d8/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/LinuxInfoUtils.java#L256-L264
   
   **To Reproduce**
   
   Always
   
   **Expected behavior**
   
   > 1,000 bit/s        = 1 [kbit/s](https://en.wikipedia.org/wiki/Kbit/s) (one 
[thousand](https://en.wikipedia.org/wiki/Thousand) bits per second)
   > 1,000,000 bit/s    = 1 [Mbit/s](https://en.wikipedia.org/wiki/Mbit/s) (one 
[million](https://en.wikipedia.org/wiki/Million) bits per second)
   > 1,000,000,000 bit/s        = 1 
[Gbit/s](https://en.wikipedia.org/wiki/Gbit/s) (one 
[billion](https://en.wikipedia.org/wiki/1000000000_(number)) bits per second)
   
   **Screenshots**
   
   **Desktop (please complete the following information):**
    - OS: linux
   
   **Additional context**
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to