TCP flow control, congestion avoidance
1
TCP flow control,congestion avoidance
Christian Dondrup (cdondrup@techfak...)Tim Nelißen (tnelisse@techfak...)
TCP
TCP flow control, congestion avoidance
2
Übersicht
• Einleitung• Sliding Window• Delayed Acknowledgements• Nagle Algorithm• Slow Start• Congestion Avoidance• Round-Trip Time (RTT)• Silly Window Syndrome• Quellen• Fragen, Anregungen
TCP
TCP flow control, congestion avoidance
3
Einleitung
• Warum lohnt sich ein zweiter Vortrag?
• Wir wollte auch einen Vortrag halten• TCP ist nicht wirklich perfekt• Ohne Kontrollen entstehen Congestions
TCP
TCP flow control, congestion avoidance
4
Sliding Window(Ergänzung)
• Das Window besteht aus 3 Pointern• 3ter Pointer wirkt als Grenze
TCP
TCP flow control, congestion avoidance
5
Delayed Acknowledgements(Ergänzung)
• Wartet bis zu 200ms (Timer)• Timer wird beim KernelBoot gestartet• Empfänger sendet gesammelte ACKs
TCP
TCP flow control, congestion avoidance
6
Delayed Acknowledgements
• Zeitdifferenz zwischen Empfang und Senden nicht genau 200ms
• RLogin benötigt echo• Server hat kein Delayed
ACK
TCP
TCP flow control, congestion avoidance
7
Nagle Algorithm(RFC 986)
•Wann es Sinn macht•Wann man es nicht braucht
TCP
TCP flow control, congestion avoidance
8
Nagle Algorithm(wann es Sinn macht)
• Wird bei langsamen Netzwerken eingesetzt (z.B. RLogin)
• 1byte-Befehle werden gesammelt• Entlastet das Netzwerk
TCP
TCP flow control, congestion avoidance
9
Nagle Algorithm(Wann man es nicht braucht)
• X-Window– (small messages wie Mausbewegung)
• Funktionstaste– sind 3 byte groß– z.B.:
• F1-Taste: ESC + [ + M• F2-Taste: ESC + [ + N
TCP
TCP flow control, congestion avoidance
10
Nagle Algorithm(Beispiel mit Nagle)
• 2tes Packet wird erst nach Empfang des ACKsgesendet
• Dauert insgesamt 3.39sec
TCP
TCP flow control, congestion avoidance
11
Nagle Algorithm(Beispiel ohne Nagle)
• Pakete werden direkt gesendet
• Geht schneller (da timeout wieder gleich schnell)
TCP
TCP flow control, congestion avoidance
13
Slow Start
• Initialisiert das Congestion Window (cwnd)• Überwacht die Ankommenden ACK‘s• Erhöht das cwnd exponentiell
TCP
TCP flow control, congestion avoidance
14
Slow Start
• Beispiel:– Das cwnd wird mit 1 initialisiert– Bei ACK auf 2 erhöht– Bei den beiden nächsten ACK‘S auf 4– Dann auf 8 erhöht usw.
TCP
TCP flow control, congestion avoidance
16
Congestion Avoidance
• 1% Paketverlust durch Beschädigung• Verstopfung (Congestion) durch zu hohe
Sendegeschwindigkeit
TCP
TCP flow control, congestion avoidance
17
Congestion Avoidance
• Slow Start und Congestion Avoidance sind zwei verschieden Algorithmen
• Beide Algorithmen werden aber zusammen implementiert, denn der eine verursacht die Verstopfung und der andere soll sie beheben.
TCP
TCP flow control, congestion avoidance
18
Congestion Avoidance
• Man nehme:– Congestion Window (cwnd)
• Wird mit 1 initialisiert– Slow Start threshold size (ssthresh)
• Wenn eine Verstopfung auftritt wird das ssthresh auf die Hälfte der Paketzahl gesetzt, aber min. 2
TCP
TCP flow control, congestion avoidance
19
Congestion Avoidance
• Bei Ankunft eines ACK wird das cwnd erhöht abhängig davon ob Slow Start oder Congestion Avoidance angewandt wird– Wenn das cwnd kleiner oder gleich der ssthresh
ist wird Slow Start angewandt, ansonsten Congestion Avoidance
TCP
TCP flow control, congestion avoidance
20
Congestion Avoidance
• Beispiel:– Verstopfung bei 32– Die ssthresh auf 16– Das cwnd auf 1
– Slow Start beginnt und erhöht die Paketzahl exponentiell
– Ab 16 Pakete übernimmt Congestion Avoidance
TCP
TCP flow control, congestion avoidance
21
Round-Trip Time (RTT)
Woher weiß TCP wie lang eine Runde ist?
TCP
TCP flow control, congestion avoidance
22
RTT
• Fundamental für TCP• Kann sich mit jedem Paket ändern und wird deshalb
jedes mal neu berechnet– Jede neue Berechnung geht zu 10% in die
geschätzte gesamt Zeit ein
TCP
TCP flow control, congestion avoidance
23
RTT
������������� ��
TCP
•R = Geschätzte gesamt RTT
•M = Gemessene RTT
•� = Glättungsfaktor (Empfohlenerweise mit dem Wert 0,9)
TCP flow control, congestion avoidance
24
Silly Window Syndrome
Was so alles passiert wenn man dies alles nicht beachtet
TCP
TCP flow control, congestion avoidance
25
Silly Window Syndrome
• Beidseitiger Fehler– Der Empfänger bietet ein Fenster mit einem Byte
an– Der Sender schickt Daten sofort wenn er sie
bekommt• Das Netz bricht unter 41 Byte Paketen zusammen
TCP
TCP flow control, congestion avoidance
26
Quellen
• W. Richard Stevens – TCP/IP Illustrated, Vol.1• Douglas E. Comer – Internetworking with TCP/IP,
Vol.1
TCP