Bug 2293 - Red Queue Estimator spins when trying to compute queue average size under long idle times
Red Queue Estimator spins when trying to compute queue average size under lon...
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: network
ns-3-dev
Mac Intel Mac OS
: P5 enhancement
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-10 08:11 UTC by l.salameh
Modified: 2016-02-11 15:40 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description l.salameh 2016-02-10 08:11:46 UTC
This is a performance bug. I have an experiment where I'm using Red Queues for web downloads. In the experiment I have idle times between resource downloads on the order of seconds. If I crank up the link rates and reduce the latency, the Estimator in the Red Queue spins for a long time trying to compute the average queue size during the idle time.

Here is the patch, instead of using a while loop, use the pow function:

--- a/src/network/utils/red-queue.cc	Fri Feb 05 01:35:39 2016 +0000
+++ b/src/network/utils/red-queue.cc	Wed Feb 10 13:07:15 2016 +0000
@@ -421,14 +421,8 @@
 RedQueue::Estimator (uint32_t nQueued, uint32_t m, double qAvg, double qW)
 {
   NS_LOG_FUNCTION (this << nQueued << m << qAvg << qW);
-  double newAve;
-
-  newAve = qAvg;
-  while (--m >= 1)
-    {
-      newAve *= 1.0 - qW;
-    }
-  newAve *= 1.0 - qW;
+  double newAve = qAvg * pow(1.0-qW, m);
+  
   newAve += qW * nQueued;
 
   // implement adaptive RED
Comment 1 Mohit 2016-02-11 08:12:23 UTC
I agree with Salameh.

The patch works fine. Just tested it.

- Mohit
Comment 2 Mohit 2016-02-11 08:13:32 UTC
I agree with Salameh.

The patch works fine. Just tested it.

- Mohit
Comment 3 Tommaso Pecorella 2016-02-11 09:21:19 UTC
Fixed - Worksforme means that the actual code shouldn't be changed.
Comment 4 Mohit 2016-02-11 10:24:56 UTC
Thank you.

FIXED!
Comment 5 Tommaso Pecorella 2016-02-11 15:40:52 UTC
Pushed in changeset:   11876:f9a8116577d5