Carol* implemented additive increase/multiplicative decrease using the following code, which works on their computer: cwnd = 1;
# After an entire CWND of data ACK’ed def increaseCwnd ():
global cwnd;
cwnd += 1;
...
# A packet lost def decreaseCwnd ():
global cwnd;
cwnd = cwnd * (1/2);
if (cwnd == 0):
cwnd = 1;
...
They submit their project without having tested it on the instructional accounts (which use Python 2.7), fail, and now work with the EE122 TAs at In-N-Out. Fortunately for you, the buggy code simplifies the throughput calculations.
*name has been changed
For Carol’s AIMD, the window size over time is: cwnd
W
…
1
W t
For correct AIMD, the window size over time is
1
: cwnd
W
…
W/2
1 t
W W/2
The tables for a-d show the calculations for Carol’s AIMD (left) and correct AIMD (right). Textual explanations are for Carol’s AIMD only. a) What is the range of window sizes that this will cycle through?
Assume that a packet loss occurs whenever cwnd reaches W.
[1, W] [W/2, W]
Note that Python 2.x (default on the instructional accounts) uses “classic division”, so (1/2) equals 0, as does “cwnd * (1/2)”; Carol’s computer presumably uses Python 3.0, which defaults to “true division” (i.e., (1/2) is equal to 0.5).
2 b) What is the average throughput (in # of packets)?
The average window size is W/2 footnote 3
. An entire window of data is sent every RTT, so the average throughput is
(
) ⁄
(
) ⁄ c) What proportion of packets is dropped?
In every sawtooth, there are W
2
/2 packets sent. One of those packets is lost, so the loss rate
[
⁄
(
)
] [
⁄
(
)
]
1
Usually there would be a slow-start phase at the start – we are only discussing plain AIMD.
2
http://www.python.org/dev/peps/pep-0238/
3
Arguably (W+1)/2, but the last packet is lost and it doesn’t matter for the asymptotic analysis.
d) What is the average throughput, as a function of the drop rate?
Inverting the equation in c):
√ √
Now substituting into the average throughput (in # of packets) equation from b):
[
√
⁄
]
√
[
√
⁄
]
To get the average throughput in bytes, multiply by the MSS.
√
What would the calculations be for a correct AIMD?
See above. e) Assuming RTT = 200ms and MSS = 1500 bytes, what drop rate is required to obtain:
6 Mbps?
√
√
√
60 Mbps?
√
√
600 Mbps?
We could also calculate:
√
( )
( ) though it might seem a bit odd to be squaring “60kbps” or “6Mbps”!
Anand returns for one of his favorite pastimes: communicating over TCP with Panda!
Panda’s TCP connection has a CWND of 18000 bytes (== 18 MSS), and all data up to byte 33000 has been
ACKed, but then a timeout occurs. List what the value of CWND would be, and what packets are sent in response to the ACKs below.
Implementation details:
Panda is not using advanced fast retransmit
during congestion avoidance, CWND += MSS / Int(CWND / MSS)
the algorithm leaves slow-start when CWND > SSTHRESH (not >=)
CACK received CWND Packets sent
(MSS
#’s)
Notes
<Timeout> 1000 34 Timeout results in CWND = MSS, and the slow start phase.
CACK for 34
SSTHRESH = <old>CWND / 2 = 9000 th
MSS 2000 35, 36 We can send one packet to replace the one that was ACKed,
CACK for 35 th
MSS 3000 37, 38 and another because the window is now one MSS larger.
CACK for 36 th
MSS 4000 39, 40
CACK for 37 th
MSS 5000 41, 42
CACK for 38 th
MSS 6000 43, 44
CACK for 39
CACK for 40 th
MSS 7000 45, 46 th
MSS 8000 47, 48
CACK for 41 st
MSS 9000 49, 50
CACK for 42 nd
MSS 10000 51, 52 CWND is over 9000 (SSTHRESH) - time to leave slow start!
CACK for 43 rd
MSS 10100 53 Increase of MSS / Int (CWND / MSS) = 1000 / Int (10000 /
1000) = 100. We can only send 1 packet, to replace the one that was ACKed.
CACK for 44 th
MSS 10200 54
CACK for 45 th
MSS 10300 55
CACK for 46 th
MSS 10400 56
CACK for 47 th
MSS 10500 57
CACK for 48 th
MSS 10600 58
CACK for 49 th
MSS 10700 59
CACK for 50 th
MSS 10800 60
CACK for 51
CACK for 52
CACK for 53 st
MSS 10900 61 nd
MSS 11000 62, 63 Window size has cumulatively increased by an MSS. rd
MSS 11090 64 Increase by 1000 / Int (11000 / 1000) = 90.
CACK for 54 th
MSS 11180 65
CACK for 54 th
MSS 11180
CACK for 54 th
MSS 11180
CACK for 54 th
MSS 5590 55
Duplicate ACK: no increase in CWND, and no packet sent.
Ditto
Third duplicate ACK: halve CWND, and resend the missing segment (“fast recovery”).
CACK for 54 th
MSS 5590 Currently in congestion avoidance, since Panda doesn’t have advanced retransmit.
CACK for 59 th
MSS 5790 New ACK: increase by MSS/Int(CWND/MSS) = 1000/ Int (5590
/ 1000) = 200
CACK for 60 st
MSS 5990 Send nothing (so close!).
What if Panda had been using advanced fast retransmit?
CACK for 53 rd
MSS 11090 64
CACK for 54 th
MSS 11180 65
CACK for 54 th
MSS 11180
CACK for 54 th
MSS 11180
CACK for 54 th
MSS 8590 55
Duplicate ACK: no increase in CWND, and no packet sent.
Ditto
Third duplicate ACK : halve CWND and add three MSS, set
SSTHRESH to 5600, and resend the missing segment (“fast recovery”)
CACK for 54 th
MSS 9590
CACK for 59 th
MSS 5590
Still in fast recovery: add an MSS for each duplicate ACK.
New ACK: set CWND to SSTHRESH, and return to congestion avoidance phase.
CACK for 60 st
MSS 5790 Increase by 1000 / Int (5590 / 1000) = 200
(This is not a very compelling demonstration of the merits of advanced fast retransmit.)
In the Stanfurd Kingdom, the feudal lords collectively own 1000 units of wood, while the serfs have only
200 wood. The total is thus 1200 wood, and the (un-)fairness index
4
is a) What is the effect of the following decrees on total income and fairness?
If the king … grants everyone 200 wood
Lord
1200
Serf
400
Total Wealth Fairness
↑ 1600 ↑ 3 demands tribute of 100 wood 900 100 ↓ 1000 ↓ 9 bestows everyone a 10% bonus 1100 220 ↑ 1320 5 taxes everyone 9% (the SimCity 4 plan) 910 182 ↓ 1092 5
Note: the arrows in the “Fairness” column indicate higher or lower fairness, but the index is as previously defined (i.e., when the index decreases, it’s higher fairness).
b) If the king wants to be able to adjust total wealth up and down, while increasing or maintaining fairness, what decrees can they use?
The only way to increase fairness is through additive increase; it also increases total wealth, so we don’t need multiplicative increase. To reduce total wealth, we could use additive decrease, but that would decrease fairness, so we instead use multiplicative decrease. i.e., AIMD.
4
There are many different metrics for inequality (e.g., (max-min)/min, (max-min)/max, (max/min) p
, etc.); this is similar to measures of squareness.