Calculating Possible Bandwidth in a Month by Link Speed

Have you ever wanted to calculate what the possible bandwidth is for a specific Network Interface? Well if so then you are in luck, I have written a simple BASH script that will do all of the calculations for you, including assisting you with estimating error. You can get this script here: You can also download this script using git.

git clone git://github.com/cloudnull/bdwcalc.git

Once you have the script, you will have to make it executable

chmod +x bdcalc.sh

Now you simply run it :

./bdcalc.sh  

You can also specify the network interface from the command line, which avoids the interactivity:

./bdcalc.sh 10 

Doing it the HARD Way

Ok So you don't trust my math, or you want to do all of this by hand... Well here is the walk through that will assist you in calculating the possible bandwidth for a specified network interface speed.

The Math Here is fairly simple, good old PEMDAS is all we need. If you do not know what PEMDAS is, you should Google it.

The First step is to get your seconds in a Day.

  • 60 Seconds in a Minute
  • 60 Minutes in an Hour
  • 24 Hours in a Day
  • 60 x 60 x 24 = 86400

Now that we know seconds in a Day, we have to computer seconds in a month. You could round to what is generally considered to be correct, using 365 days in a year and 30 days in a month, but I am a nerd so I attempted to be more accurate. According to Astrology there are 365.24219 Days in a year. (This is how we get a Leap Year) and there are 12 months in a year, this is a constant based on the western calendar.

To computer the days in a Month we do:

  • 365.24219 Days in a year
  • 12 Months per year
  • 365.24219 / 12 = 30.4368 : (rounded to 4 Decimal Places)

Now we take our seconds in a day and multiply that by days in a month.

  • 86400 Seconds in a Day
  • 30.4368 Mean Days in a Month
  • 30.4368 x 86400 = 2628875.52

Now that we have the Mean Seconds in a Month, we have to determine what our link speed will be. In this example we are going to calculate what the total possible bandwidth will be in a month for a 10 Megabit Per seconds connection.

To begin we will take our Seconds in a Month and multiple it by our Network Interface speed.

  • 2628875.52 Seconds in a Month
  • 10 Network Interface Speed
  • 2628875.52 x 10 = 26288755.2

Now that we have our connection speed we have to translate it into Binary. To do this, divide this output by 8, this is because there are 8 bits in a byte and we are determining the link speed of a Network card in Megabytes.

  • 26288755.2 Network Card’s Bits in a Month
  • 8 Bits in a Byte
  • 26288755.2 / 8 = 3286094.4

Your 10 Megabit Network Card is capable of 3286094.4 MB in a month

From this last computation we have the total Megabytes your 10 Megabit Network interface is capable of in a month. However, to translate this into a more legible format we can convert this quotient into Gigabytes. To do this we have to divide the quotient by 1024, as there are 1024 Megabytes in a Gigabyte.

  • 3286094.4 Megabytes Per Month
  • 1024 Megabytes in a Gigabyte
  • 3286094.4 / 1024 = 3209.0765 : (Rounded to 4 decimal Places)

To this end we can determine that your Network card is capable of pushing 3,209 Gigabytes of bandwidth in a month. Though it should be noted that this is the capability, the real word overall usage will be less. Even if you did run at full speed for an entire month, the true value would still be a little lower and would never be the same, month to month. This is because the network link speed is determined by the settings for the NIC, but is controlled by the operating system. Essentially there are a tun of veriables that could effect the Link Speed. Here are some basic examples : Reboot, Service Restart, High CPU load, High Memory Usage, Network slowdown, Network Trouble, or some kind of Network hiccup. To account for these variables, I add a 7% margin of error to the equation, which gives me what I determine to be the Real World Bandwidth possible.

  • 3209.0765 x .07 = 224.6353 : (Rounded to 4 decimal Places)
  • 3209.0765 - 224.6353 = 2984.4412 : (Rounded to 4 decimal
    Places)

So the real world Bandwidth in a month should be 2984.4412 GB per month.

If you enjoyed this post or if this has helped you, please comment and make sure to subscribe to my rss feed.

Mastodon