# Bandwidth fairness

Gustavus has developed a device to enforce **bandwidth fairness** in order to ensure that typical Internet users can use the Internet when other users constantly try to use as much as they can.

## How it works

- Several times an hour, a computer calculates how much bandwidth each computer has used in the previous 24 hours.
- This computer then configures our Internet connection so that
*if we are using all of our bandwidth*, computers which have not used much bandwidth get priority over computers that have already used a lot. - The result is the more bandwidth each computer uses, the slower their Internet connection will be in comparison to a computer which has not used much bandwidth in the previous 24 hours.

## Goals

The goal of bandwidth fairness is to slow down computers which use more than their "fair share" of the bandwidth and let other computers have a turn.

**If there is bandwidth available, people will always be allowed to download as fast as possible.**

## Priority queues

Bandwidth fairness does not use priority queues because with priority queues a computer which had not used much bandwidth recently could "starve" a computer which had used a lot of bandwidth, and prevent their Internet connection from working at all.

## Bandwidth fairness ratios

Instead we use "bandwidth fairness ratios" which give people proportionally less throughput as they use more bandwidth.

As an example of how bandwidth fairness ratios work here is a table of 24 hour bandwidth usage and the respective priority they would get. (Although the thresholds are subject to change.)

If a computer has downloaded | It will download this much for every 1MB which a computer which has downloaded less than 100MB can download |
---|---|

1MB-99MB | 1MB |

100MB-499MB | 512KB |

500MB-999MB | 256KB |

1000MB-1499MB | 128KB |

1500MB-1999MB | 64KB |

2000MB-2499MB | 32KB |

2500MB-2999MB | 16KB |

3000MB-3499MB | 8KB |

3500MB-3999MB | 4KB |

4000MB+ | 2KB |

In other words, if you have downloaded 150MB, you will download at half the speed as someone who has downloaded 50MB and four times the speed of someone who has downloaded 1200MB.