I have an application that consumes a lot of network traffic. I used psutil to measure network activity in kbits with the following code:
old_value = psutil.net_io_counters(nowrap=True).bytes_sent + psutil.net_io_counters(nowrap=True).bytes_recv
sleep(1)
while True:
new_value = psutil.net_io_counters(nowrap=True).bytes_sent + psutil.net_io_counters(nowrap=True).bytes_recv
net_usage = (new_value - old_value)/1024.0 * 8
old_value = new_value
print(net_usage)
sleep(1)
Before that, I limited the network to 10Mbps using the following command:
ethtool -s eth0 speed 10 duplex full autoneg off
I expected to see a list of numbers close to 10000kbit, instead, the numbers were clearly limited by a number close to ~6380:
Is there an explanation for this? I.e. why the limit was not 10000, even though the numbers were clearly limited by the ethtool? Is my measuring code or expectations somehow flawed?
EDIT: My application uses the network mainly for uploading the data. Is it possible that the limit of 10Mbit is split between upload and download directions by ethtool and upload is assigned only 6.4 Mbit?