Sign in to follow this  
Angus Hollands

Algorithms / techniques to determine available bandwidth

Recommended Posts

Angus Hollands    869

Hi everyone,

As the question states, I was wondering how best to determine the available bandwidth of a connection. I intend to determine the update frequency of a networked entity based upon its network priority and the available bandwidth.

Any ideas?

Thanks,

Angus.

Share this post


Link to post
Share on other sites
Nikopol_AU    767

The problem is that connection quality can change over time.

In both directions.

 

Start sending updates at certain pre-defined rate.

When connection quality decreases (more and more packets get dropped), you respond by decreasing your update rate.

When connection quality has been good for certain time, you can start to increase your update rate.

Share this post


Link to post
Share on other sites
hplus0603    11347

The short answer is that you can't, and if utilizing bandwidth efficiently is your goal, you should use TCP.

 

The long answer is that you can use packet loss as a proxy for bandwidth, and slowly increase the bandwidth until you get a dropped packet, and then quickly throttle back. Where "slowly" means "linearly add some constant to your estimate of bandwidth" and "quickly" means "halve the estimated throughput," you will behave like traditional TCP stacks. (Main improvements in later years: quick-start, path memory, window scaling mechanisms.)

 

It's important that you behave like this (quick scale-back, slow growth) to avoid overwhelming some local choke point, or getting into extreme oscillation, when other sources of traffic are also sharing the connection.

 

If you use TCP, then set a buffer size that you're willing to live with, and keep sending on the socket. When the send blocks and/or doesn't transfer all the data, you know that the buffer is full, and thus the other end is behind compared to the speed you have been sending at.

 

Note that, when your girlfriend starts watching Netflix, or your ISP is doing router maintenance, the available bandwidth for an existing connection may quickly change!

Share this post


Link to post
Share on other sites
Angus Hollands    869
And what sort of tolerance should I use for dropped packets (so that a batch of five successive packets that may be dropped don't lead to a reduction of 0.5^5
Would you advise having a safe window of the rtt + x to ensure that we only see new feedback?

Share this post


Link to post
Share on other sites
hplus0603    11347
Five packets dropped in a row does mean that you have a significant network congestion event, and should drastically scale back your estimate.
Perhaps you could say that each successive dropped packet after the first dropped packet after a successful packet back down by 0.8 instead of 0.5, but you'd still need to back off significantly if you get a significant amount of packet drop.

Feel free to keep a "minimum accepted" level, and either not drop below that, or kick the user off if it cannot be maintained (with proper user messaging so the user knows what the problem is.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this