1 00:00:00,000 --> 00:00:05,000 In its basic form, TCP may have a window size of 1 2 00:00:06,000 --> 00:00:10,000 which means that for every segment transmitted by the sender 3 00:00:11,000 --> 00:00:16,000 the receiver sends an acknowledgement for that individual segment. 4 00:00:17,000 --> 00:00:19,000 This however slows down the throughput dramatically 5 00:00:20,000 --> 00:00:23,000 because the sender cannot transmit anymore data 6 00:00:24,000 --> 00:00:29,000 until it to receives acknowledgement of that single segment transmitted. 7 00:00:30,000 --> 00:00:32,000 The throughput would be very low 8 00:00:33,000 --> 00:00:34,000 depending on the round trip timer 9 00:00:35,000 --> 00:00:38,000 between sending data and receiving the acknowledgement. 10 00:00:39,000 --> 00:00:42,000 TCP however thus allow for greater window sizes 11 00:00:43,000 --> 00:00:44,000 to allow for more segments 12 00:00:45,000 --> 00:00:48,000 to be transmitted before receiving an acknowledgement. 12 13 00:00:49,000 --> 00:00:50,000 The window is the number of data segments 14 00:00:51,000 --> 00:00:52,000 the sender is allowed to send 15 00:00:53,000 --> 00:00:56,000 without getting an acknowledgement from the receiver. 16 00:00:57,000 --> 00:00:58,000 In this case we’ve set it to 1 17 00:00:59,000 --> 00:01:02,000 that means when host A wants to send traffic to host B 18 00:01:03,000 --> 00:01:07,000 it can send 1 segment because the window size is set to 1 19 00:01:03,000 --> 00:01:07,000 host B, once it receives that segment, sends an acknowledgement. 20 00:01:14,000 --> 00:01:18,000 In this example, let’s assume that host A, send the segment with the sequence number of 1 21 00:01:19,000 --> 00:01:21,000 host B would acknowledge for segment 2. 22 00:01:22,000 --> 00:01:24,000 Host A will then send segment 2 23 00:01:25,000 --> 00:01:29,000 and host B, once successfully receiving that segment 24 00:01:30,000 --> 00:01:32,000 will acknowledge or ACK for segment 3. 25 00:01:33,000 --> 00:01:36,000 Host A will then send segment 3 to host B. 26 00:01:37,000 --> 00:01:41,000 This process will then continue for the duration of the session 27 00:01:42,000 --> 00:01:46,000 this is obviously very reliable however, the throughput is very low. 28 00:01:47,000 --> 00:01:50,000 A would need to buffer outgoing segments 29 00:01:51,000 --> 00:01:54,000 until it receive an acknowledgement for the segment transmitted. 30 00:01:55,000 --> 00:01:57,000 now for argument sake 31 00:01:58,000 --> 00:02:00,000 let’s assume that it takes 1 second for traffic 32 00:04:04,000 --> 00:04:06,000 with the start with the small window size 33 00:04:07,000 --> 00:04:10,000 and then exponentially increase the window size to gauge 34 00:04:11,000 --> 00:04:15,000 the amount of data that the receiver can receive and what the network can handle. 35 00:04:16,000 --> 00:04:20,000 You’ve probably notice this, when downloading a file from the internet 36 00:04:21,000 --> 00:04:23,000 initially the download speed is slow 37 00:04:24,000 --> 00:04:27,000 but then increases to a certain point over time. 38 00:04:28,000 --> 00:04:31,000 This is because the window size initially are small 39 00:04:32,000 --> 00:04:35,000 but then increases exponentially until a packet is dropped 40 00:04:36,000 --> 00:04:40,000 or the receiving host cannot handle the amount of data it's receiving. 41 00:04:41,000 --> 00:04:43,000 So you’ll notice initially, that the download speed is very slow 42 00:04:44,000 --> 00:04:47,000 increases very quickly and then gets to a point 43 00:04:48,000 --> 00:04:49,000 and then stays around that speed. 44 00:04:50,000 --> 00:04:51,000 So once again, let’s assume 45 00:04:52,000 --> 00:04:55,000 that the hosts in this example have a fixed window size of 3. 46 00:04:56,000 --> 00:05:01,000 That means that A can send 3 segments before receiving an acknowledgement. 47 00:05:02,000 --> 00:05:05,000 So in this case host A sends segment 1,2 and 3 48 00:05:06,000 --> 00:05:10,000 host B acknowledges for segment 4 49 00:05:11,000 --> 00:05:15,000 thus letting A know that it successfully received segment 1,2 and 3 50 00:05:16,000 --> 00:05:21,000 host A then sends segment 4,5 and 6 because it has a fix window size of 3 51 00:05:22,000 --> 00:05:25,000 and host B acknowledges for segment 7 52 00:05:26,000 --> 00:05:31,000 thus letting A know, that it had received segments 4,5 and 6. 53 00:05:32,000 --> 00:05:37,000 Remember with acknowledgements, acknowledge the next segment that you want to received 54 00:05:38,000 --> 00:05:40,000 not the segment that you have already received. 80 55 00:05:41,000 --> 00:05:44,000 So host B does not acknowledge for segment 6 56 00:05:45,000 --> 00:05:46,000 but acknowledges segment 7. 57 00:05:47,000 --> 00:05:52,000 As I've mentioned, a sliding window allows hosts to gauge 58 00:05:53,000 --> 00:05:57,000 the amount of data the receiver can receive and what the network can handle. 59 00:05:58,000 --> 00:06:01,000 So in this example let’s assume that the host are using a sliding window 60 00:06:02,000 --> 00:06:05,000 the way that they determine what the network can handle 61 00:06:06,000 --> 00:06:10,000 is when a packet is dropped by the network, the host will slow down. 62 00:06:11,000 --> 00:06:13,000 This information is covered in a lot more detail 63 00:06:14,000 --> 00:06:17,000 in courses that contain quality of service. 64 00:06:18,000 --> 00:06:20,000 With this course just assume that when a packet gets drop 65 00:06:21,000 --> 00:06:23,000 they reduced their window size dramatically 66 00:06:24,000 --> 00:06:32,000 in brief, the window size is either the window granted to the sender by the receiver 67 00:06:33,000 --> 00:06:38,000 or a calculated window called the congestion window or CWND 68 00:06:39,000 --> 00:06:45,000 the congestion window or CWND is initially set to very low value 69 00:06:46,000 --> 00:06:49,000 at connection establishment and then increases at an exponential rate. 70 00:06:50,000 --> 00:06:53,000 For every lost segment, the congestion window is half 71 00:06:54,000 --> 00:06:57,000 after lost segment has been successfully re-transmitted 72 00:06:58,000 --> 00:07:01,000 the congestion window grows again until it reaches 73 00:07:02,000 --> 00:07:05,000 a value half of the original congestion window 74 00:07:06,000 --> 00:07:11,000 it then slows down its growth, using an algorithm called congestion avoidance. 75 00:07:12,000 --> 00:07:17,000 It does exponentially grows up to half the original congestion window size 76 00:07:18,000 --> 00:07:21,000 and then increases slowly at the linear rate. 77 00:07:22,000 --> 00:07:27,000 In quality of service Weighted Random Early Detection or WRED 78 00:07:28,000 --> 00:07:33,000 can be used improve efficiency of TCP transmissions across the link 79 00:07:34,000 --> 00:07:39,000 as packets are randomly dropped from various flows or various sessions 80 00:07:40,000 --> 00:07:41,000 going across an individual interface 81 00:07:42,000 --> 00:07:45,000 rather than packets from multiple senders being drop at the same time. 82 00:07:46,000 --> 00:07:49,000 this avoid an issue called global synchronization 83 00:07:50,000 --> 00:07:54,000 where packets from multiple TCP sessions are drop at the same time 84 00:07:55,000 --> 00:08:01,000 and therefore multiple host reduce their window size and slowdown at the same time 110 85 00:08:02,000 --> 00:08:04,000 and then gradually increase their window size 86 00:08:05,000 --> 00:08:08,000 and therefore their throughput at the same time. 87 00:08:09,000 --> 00:08:14,000 So you have a many hosts slowing down and speeding up at the same time 88 00:08:15,000 --> 00:08:17,000 with WRED some hosts will be slowing down 89 00:08:18,000 --> 00:08:24,000 and other hosts will be increasing their throughput because or random drops. 90 00:08:25,000 --> 00:08:30,000 Please refer to quality of service documentation for more detail about WRED 91 00:08:34,000 --> 00:08:39,000 In this example let’s assume that we start with the initial window size of 3. 92 00:08:40,000 --> 00:08:49,000 So A transmits 3 segments to B, however only segment 1 and 2 arrive at host B 93 00:08:50,000 --> 00:08:52,000 segment 3 goes missing. 94 00:08:53,000 --> 00:09:00,000 Host B may reduce its window size in this example to 2 and acknowledge segment 3. 95 00:09:01,000 --> 00:09:08,000 Remember the acknowledgement is for the next packet that that hosts expects to receive 96 00:09:10,000 --> 00:09:12,000 and because host B did not receive segment 3 97 00:09:13,000 --> 00:09:17,000 it’s acknowledging successful receipt of segment 1 and 2. 98 00:09:18,000 --> 00:09:25,000 Host A will re-transmit segment 3 and in this example send segment 4 99 00:09:26,000 --> 00:09:27,000 but also request a window size of 3. 100 00:09:28,000 --> 00:09:32,000 Both those segment are successfully received by host B 101 00:09:33,000 --> 00:09:35,000 so host B will acknowledge for segment 5 102 00:09:36,000 --> 00:09:39,000 but in this example, still wants a window size of 2. 103 00:09:40,000 --> 00:09:45,000 Host A will only send 2 segments because the negotiated window size is 2 104 00:09:46,000 --> 00:09:51,000 but A may still request that the window size be increase to 3. 105 00:09:52,000 --> 00:09:57,000 With the sliding window, there is dynamic negotiation of a window size 106 00:09:58,000 --> 00:10:02,000 and that window size may change dramatically during a session 107 00:10:03,000 --> 00:10:07,000 depending on what the receiver can process and what the network can handle.