Docsity

study guide 6.3-9.1 for networks, Resumos de Segurança Computadorizada

Toggle sidebar
bg1
Sections 6.3 & 9.1–9.1.3 Computer Networks — Final Quiz Study Guide
Computer Networks: Final Quiz Study Guide
Sec. 6.3: TCP Congestion Control |Sec. 9.1–9.1.3: Traditional Applications & Web
Services
Peterson & Davie — Computer Networks: A Systems Approach
Quiz format: 2 high-level integrative questions + 1 specific TCP congestion suite question
Contents
1 Section 6.3 — TCP Congestion Con-
trol 2
1.1 Motivation and Core Idea ..... 2
1.2 6.3.1 — Additive Increase / Mul-
tiplicative Decrease (AIMD) .... 2
1.3 6.3.2 — Slow Start ......... 3
1.4 6.3.3 — Fast Retransmit and Fast
Recovery ............... 3
1.5 6.3.4 — TCP CUBIC (brief) . . . 4
1.6 Named TCP Variants Summary . . 5
1.7 Wireless: When Loss = Congestion 5
2 Section 9.1 — Traditional Applica-
tions 6
2.1 9.1.1 — Electronic Mail (SMTP,
MIME, IMAP) ........... 6
2.2 9.1.2 — World Wide Web (HTTP) 7
2.3 9.1.3 — Web Services ....... 9
3 Exam Preparation: Sample Ques-
tions & Model Answers 11
3.1 Sample Question 1 — High-Level
Integration: TCP & HTTP . . . . 11
3.2 Sample Question 2 — High-Level
Integration: Application Design
Principles .............. 11
3.3 Sample Question 3 — Specific:
The TCP Congestion Suite . . . . 12
3.4 Quick-Reference Fact Sheet . . . . 13
Peterson & Davie 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Pré-visualização parcial do texto

Baixe study guide 6.3-9.1 for networks e outras Resumos em PDF para Segurança Computadorizada, somente na Docsity!

Computer Networks: Final Quiz Study Guide

Sec. 6.3: TCP Congestion Control | Sec. 9.1–9.1.3: Traditional Applications & Web

Services

Peterson & Davie — Computer Networks: A Systems Approach Quiz format: 2 high-level integrative questions + 1 specific TCP congestion suite question

Contents

1 Section 6.3 — TCP Congestion Con- trol 2 1.1 Motivation and Core Idea..... 2 1.2 6.3.1 — Additive Increase / Mul- tiplicative Decrease (AIMD).... 2 1.3 6.3.2 — Slow Start......... 3 1.4 6.3.3 — Fast Retransmit and Fast Recovery............... 3 1.5 6.3.4 — TCP CUBIC (brief)... 4 1.6 Named TCP Variants Summary.. 5 1.7 Wireless: When Loss ̸= Congestion 5

2 Section 9.1 — Traditional Applica- tions 6

2.1 9.1.1 — Electronic Mail (SMTP, MIME, IMAP)........... 6 2.2 9.1.2 — World Wide Web (HTTP) 7 2.3 9.1.3 — Web Services....... 9

3 Exam Preparation: Sample Ques- tions & Model Answers 11 3.1 Sample Question 1 — High-Level Integration: TCP & HTTP.... 11 3.2 Sample Question 2 — High-Level Integration: Application Design Principles.............. 11 3.3 Sample Question 3 — Specific: The TCP Congestion Suite.... 12 3.4 Quick-Reference Fact Sheet.... 13

Section 6.3 — TCP Congestion Control

Motivation and Core Idea

Why Congestion Control?

Before 1988, TCP had no congestion control. Hosts sent as fast as the receiver’s window allowed. The result was congestion collapse: dropped packets triggered retransmissions, adding yet more load in a vicious cycle. Van Jacobson’s solution (1988): A sender-side CongestionWindow variable limits in-flight data:

MaxWindow = min(CongestionWindow, AdvertisedWindow)

EffectiveWindow = MaxWindow − (LastByteSent − LastByteAcked) TCP infers congestion from loss events (timeouts or 3 duplicate ACKs) because packet drops due to errors are rare — virtually all drops are congestion-related. TCP is therefore end-to-end: no router changes needed. Self-clocking: Each arriving ACK signals one packet left the network ⇒ safe to inject one new packet. ACKs pace the transmission.

6.3.1 — Additive Increase / Multiplicative Decrease (AIMD)

AIMD Mechanism Multiplicative Decrease (triggered by timeout):

CongestionWindow ← CongestionWindow 2

(never below 1 MSS)

Example: 16 → 8 → 4 → 2 → 1 on repeated timeouts. Additive Increase (each ACK received, once in stable phase):

Increment = MSS ×

MSS

CongestionWindow

CongestionWindow += Increment

This yields +1 MSS per RTT — linear growth. Result over time: characteristic sawtooth pattern.

Why AIMD and not additive increase/additive decrease? Decreasing aggressively (mul- tiplicative) and increasing conservatively (additive) is a necessary condition for stability. The con- sequence of an overly large window (dropped packets ⇒ retransmissions ⇒ more congestion) far outweighs the cost of a briefly too-small window.

Exam Note: Timeout Mechanism TCP’s retransmission timeout is set as a function of both the average RTT and the standard deviation of RTT. To save clock overhead, TCP samples the RTT once per RTT using a coarse-grained 500 ms clock.

Effect: Eliminates roughly half of coarse-grained timeouts on typical TCP connections, improving throughput by about 20%. However, Fast Retransmit cannot detect up to more than three dropped packets per window — small windows still rely on timeouts.

Fast Recovery

After Fast Retransmit (dup-ACK path), rather than resetting cwnd to 1 and running Slow Start:

  1. CongestionThreshold ← cwnd / 2
  2. CongestionWindow ← CongestionThreshold
  3. Resume additive increase (skip Slow Start entirely) Why skip Slow Start? Duplicate ACKs show that later data is flowing — the pipe is not completely empty. This is a less severe signal than a full timeout, so only a half-cut is needed, not a full reset to 1. Example from trace (Figure 6.13): Fast Recovery avoids the Slow Start dip between 3. and 4 seconds; instead the window halves from 22 kB to 11 kB and additive increase resumes immediately.

When Does Slow Start Run vs. Not? ˆ Run Slow Start: Start of a new connection; after a coarse-grained timeout. ˆ Skip Slow Start (use Fast Recovery): After 3 duplicate ACKs (Fast Retransmit path). ˆ Otherwise: Pure AIMD (additive increase).

6.3.4 — TCP CUBIC (brief )

CUBIC — Default Linux TCP Goal: Better performance on long-fat networks (high delay × bandwidth product) where standard TCP ramps up too slowly. Key ideas: ˆ Window updated based on time elapsed since last congestion event, not only on ACK arrival ⇒ fairer when competing with short-RTT flows. ˆ Window follows a cubic function: CWND(t) = C(t − K)^3 + Wmax, where Wmax is the window size just before the last congestion event and K = 3

p Wmax(1 − β)/C. ˆ Multiplicative decrease factor β = 0.7 (vs. 0.5 in standard TCP). ˆ Shape: slow/cautious growth near Wmax; aggressive probing far from Wmax.

Named TCP Variants Summary

Variant Key Features

TCP Tahoe Original Jacobson: AIMD + Slow Start. No Fast Recovery. Drops to cwnd = 1 after any loss. TCP Reno Adds Fast Recovery after 3 dup-ACKs; halves window, resumes AIMD. Also: delayed ACKs, header prediction. TCP Vegas Source-based avoidance: detects congestion before loss via rising RTT. Not widely deployed. TCP CUBIC Default in Linux; cubic window function; time-based (not ACK-based) updates.

Wireless: When Loss ̸= Congestion

TCP on Wireless Links TCP treats all loss as congestion. On wireless links, packets drop due to bit errors (not congestion). TCP reduces its window unnecessarily, potentially throttling to 1 packet/RTT. Mitigations: ˆ Link-layer FEC (e.g., 802.11): correct errors before TCP sees them. ˆ Link-layer retransmissions: hide loss from TCP (increases RTT variance). ˆ Split TCP connection: treat wireless and wired segments separately. ˆ Intelligent detection: rising RTT and ECN marks suggest congestion; correlated losses suggest bit errors.

Command Purpose Response codes HELO domain Client identifies itself 250 OK MAIL FROM: Specify sender 250 OK RCPT TO: Specify recipient 250 (OK), 550 (no user), 251 (will forward) DATA Begin body 354 (send it); 250 (done) QUIT Close 221 VRFY Verify address

The MAIL FROM and RCPT TO arguments form an envelope that the MTA uses for routing, separate from the RFC 822 headers. A 251 response indicates the host will forward — it is acting as a mail gateway.

Mail Retrieval: IMAP

IMAP: Remote Mailbox Access ˆ Role: Let a mail client (laptop, phone) remotely access and manage a mailbox on a mail server. ˆ Runs over TCP; ASCII text, CRLF-terminated. Client authenticates, then issues commands. ˆ Commands: LOGIN, LOGOUT, FETCH (returns MIME-encoded message), STORE, DELETE, EXPUNGE. ˆ Responses: OK, NO (no permission), BAD (ill-formed command). ˆ Message flags: Seen, Answered, Deleted, Recent — synchronise state between client and server. ˆ When the user sends a reply, the mail reader uses SMTP (not IMAP) to submit to the mail server.

9.1.2 — World Wide Web (HTTP)

URLs and the Web

HTTP Architecture ˆ Hypertext: Documents contain links (URLs/URIs) to other documents on potentially different machines. ˆ URL: http://www.cs.princeton.edu/index.html — scheme + host + path. ˆ URI (Uniform Resource Identifier): General form; a URL is a URI that also specifies retrieval. URIs can be non-retrievable (e.g., XML namespace IDs). ˆ HTTP is a request/response protocol over TCP (reliable delivery, flow control, con- gestion control).

HTTP Message Format

Every HTTP message follows:

START_LINE MESSAGE_HEADER (zero or more; blank line terminates)

MESSAGE_BODY

HTTP Request Methods and Response Codes

Request methods:

GET Retrieve document (most common) HEAD Retrieve metadata only; test link validity / freshness POST Submit data to server (forms; also enables spam) PUT Store document under given URL DELETE Delete URL OPTIONS / TRACE / CONNECT Misc. utility methods

Response code classes:

1xx Informational Continue 2xx Success 200 OK, 202 Accepted 3xx Redirection 301 Moved Permanently, 302 used heavily by CDNs 4xx Client error 404 Not Found 5xx Server error Server failed a valid request

HTTP/1.0 vs. 1.1 vs. 2.

TCP Connections in HTTP: A Key Integration with Congestion Control

HTTP/1.0 — Non-persistent (1 TCP connection per object): ˆ A page with 12 embedded images ⇒ 13 separate TCP connections (setup + teardown each time). ˆ Each connection starts Slow Start from scratch ⇒ throughput is heavily penalised.

HTTP/1.1 — Persistent connections: ˆ Multiple request/response exchanges on one TCP connection. ˆ CongestionWindow grows across requests; no Slow Start restart per page. ˆ Server must time out idle connections (added complexity), but benefits far outweigh costs.

HTTP/2 (2015) — Two major additions: ˆ Server push + compression: Server proactively bundles and sends resources the browser will need, avoiding extra round trips. Header compression reduces bytes. ˆ Stream multiplexing: Multiple concurrent requests on one TCP connection (each a stream with unique ID); requests can overlap, unlike HTTP/1.1’s sequential pipelining.

Caching

Web Caching

Caches can be: browser-local, site-wide cache, ISP proxy (transparent or configured). HTTP cache control: ˆ Expires: header — cache serves without revalidation until this date. ˆ After expiry: HEAD or conditional GET (If-Modified-Since:) checks freshness. ˆ Cache directives (must-obey by all intermediaries): whether/how long a document may be cached, freshness requirements.

REST SOAP/WSDL

Protocol HTTP (fixed) Custom per-application Interface style Data/document-oriented Procedural/operation-based Legacy integration Harder Easier (maps to procedures) Infrastructure Web-proven, scalable Requires toolkits

Amazon (2002): both exposed; majority of developers chose REST.

Cloud-Native and Microservices (brief )

Beyond Web Services

ˆ Moving a legacy app into a cloud VM = Web Services in the cloud (architecture un- changed). ˆ Cloud-native: designed from scratch for scalable cloud platforms using the microser- vices architecture. ˆ Current debate: REST + JSON vs. gRPC + Protobufs for microservices RPC — both run over HTTP.

Exam Preparation: Sample Questions & Model Answers

Sample Question 1 — High-Level Integration: TCP & HTTP

Q1: How does TCP congestion control interact with HTTP performance?

Explain how TCP’s congestion control mechanisms affect HTTP performance, and how HTTP versions 1.1 and 2.0 address the resulting problems. Model answer:

  1. HTTP/1.0 and the Slow Start penalty. HTTP/1.0 opens a separate TCP connection for every object. Each new connection must run Slow Start from cwnd = 1, spending mul- tiple RTTs ramping up before reaching efficient throughput. Short-lived connections often close before the window fully opens, so the Slow Start phase dominates. On a page with n embedded objects, TCP incurs n separate Slow Start phases.
  2. HTTP/1.1 persistent connections eliminate repeated Slow Start. By reusing a single TCP connection for multiple requests, the congestion window survives across requests and can grow over time. TCP’s self-clocking and AIMD operate efficiently. The textbook explicitly notes that persistent connections allow “TCP’s congestion window mechanism to operate more efficiently”.
  3. HTTP/2 multiplexing further reduces latency. Concurrent streams on one connec- tion allow requests to overlap, eliminating head-of-line blocking. Server push avoids round trips for predictable sub-resources. Both features reduce the number of new TCP connections (and therefore Slow Start episodes) even further. Key insight for exam: TCP congestion control only works well when connections persist long enough for the window to grow. HTTP/1.1+ is designed to align with this requirement.

Sample Question 2 — High-Level Integration: Application Design Principles

Q2: What design principles do traditional application protocols illustrate?

Both SMTP and HTTP implement request/reply over TCP rather than using a general RPC protocol. Compare how these protocols are designed, noting what they share and how they differ. Then explain how Web Services (REST and SOAP) extend these principles to application-to-application communication. Model answer: Shared principles (SMTP and HTTP): ˆ Both run directly over TCP (reliable delivery, flow control, congestion control). ˆ Both are ASCII-based, text-oriented request/response protocols. ˆ Both separate the transfer mechanism (SMTP, HTTP) from the data format (RFC 822 + MIME; HTML + MIME). This allows diverse clients/servers to interoperate. ˆ Both use companion standards to handle complexity: MIME for encoding binary data in ASCII; HTML for structuring web pages. Key differences: ˆ SMTP is store-and-forward through multiple gateways; messages are delivered asyn- chronously. Uses a small set of commands (HELO, MAIL, RCPT, DATA). ˆ HTTP is synchronous (request → immediate response). Far richer method set (GET, POST, PUT, etc.) and response codes (1xx–5xx). Designed for concurrent object retrieval. Extension to Web Services: HTTP’s simplicity proved so powerful it became the transport

Quick-Reference Fact Sheet

Must-Know Facts for the Quiz

TCP Congestion Control ˆ EffectiveWindow = min(cwnd, rwnd) − in-flight

ˆ AIMD increment per ACK: MSS^2 /cwnd

ˆ Slow Start: cwnd doubles every RTT

ˆ Fast Retransmit: 3 dup-ACKs

ˆ Fast Recovery: halve cwnd; skip Slow Start

ˆ CUBIC β = 0.7 (vs. 0.5 standard)

ˆ Slow Start is exponential, NOT slow

ˆ Timeout → Slow Start; dup-ACKs → Fast Recovery

Applications ˆ HTTP/1.0: 1 TCP connection/object ˆ HTTP/1.1: persistent; sequential ˆ HTTP/2: streams (concurrent) + push ˆ 302 redirect: CDN use case ˆ SMTP: TCP; ASCII; store-and-forward gateways ˆ IMAP: TCP; remote mailbox; flags; SMTP to send ˆ MIME base64: 3 bytes → 4 ASCII chars ˆ REST: HTTP + URIs; data-oriented ˆ SOAP: XML; custom protocols; header block modules ˆ DNS A record: name → IP address