For a more practical example of this, consider a file download. You are currently downloading a 100 MB file at the rate of 1 MB/s. This is very easy to determine the estimated time of completion. But 75% of the way there, some network congestion hits and your download rate drops to 500 KB/s.
Depending on how the browser calculates the remaining time, your ETA could instantly go from 25 seconds to 50 seconds (using present state only: Size Remaining / Download Speed
) or, most likely, the browser uses a rolling average algorithm which would adjust for fluctuations in transfer speed without displaying dramatic jumps to the user.
An example of a rolling algorithm with regards to downloading a file might work something like this:
- The transfer speed for the previous 60 seconds is remembered with the newest value replacing the oldest (e.g. the 61st value replaces the first).
- The effective transfer rate for the purpose of calculation is the average of these measurements.
- Time remaining is calculated as: Size Remaining / Effective Download Speed
So using our scenario above (for the sake of simplicity, we will use 1 MB = 1,000 KB):
- At 75 seconds into the download, our 60 remembered values would each be 1,000 KB. The effective transfer rate is 1,000 KB (60,000 KB / 60) which yields a time remaining of 25 seconds (25,000 KB / 1,000 KB).
- At 76 seconds (where the transfer speed drops to 500 KB), the effective download speed becomes ~992 KB (59,500 KB / 60) which yields a time remaining of ~24.7 seconds (24,500 KB / 992 KB).
- At 77 seconds: Effective speed = ~983 KB (59,000 KB / 60) yielding time remaining of ~24.4 seconds (24,000 KB / 983 KB).
- At 78 seconds: Effective speed = 975 KB (58,500 KB / 60) yielding time remaining of ~24.1 seconds (23,500 KB / 975 KB).
You can see the pattern emerging here as the dip in download speed is slowly incorporated into the average which is used to estimate the time remaining. Under this method, if the dip only lasted for 10 seconds and then returned to 1 MB/s the user is unlikely to notice the difference (save for a very minor stall in the estimated time countdown).
Getting to the brass tacks – this is simply methodology for relaying information to the end user for the actual underlying cause…