2 – Application Layer

Network applications

Network core doesn’t run user applications.

App architectures

Client-server architecture

P2P architecture

Process communication

Process: program running in host.

(P2P architectures must have both in each peer!)

Inter-process communication (IPC) across different hosts by exchanging messages (data packets @ application layer)

Sockets

A local process sends/receive messages to/from its socket (the interface between application and the transport layers, i.e., between localhost and entire internet)

Note: Application layer (upper layer) utilizes the transport layer (below) for its transport service.

Analogy: the door between your localhost and “outdoors” outside of your localhost. It is an abstraction (like an API).

Addressing processes

Motivation:

The identifier includes IP address and port numbers.

Miscellaneous:

Transport service requirements

Different services have different requirement dimensions:

Transport layer services

Only 2 types of services provided by transport layer.

TCP

UDP

App-layer protocol

Web and HTTP

HTTP: HyperText Transfer Protocol uses TCP

Process:

  1. Client initiates TCP to server (creating a socket on port 80)
  2. Server accepts TCP connection from client
  3. HTTP messages exchanged between client and server
  4. Close TCP connection

Features of HTTP:

Roundtrip Time (RTT): Time for a small packet to travel from client to server and back (2x end-to-end delay)

Client-server HTTP request-response

HTTP messages

Request

  1. Request line (GET, POST, HEAD etc. commands)
  2. Header lines (Header field + Corresponding value)
  3. Carriage return
  4. Entity body for POST, PUT commands etc.
GET /Panopto/Pages/Viewer.aspx?id=956d6d43-941c-45a0-8c3e-ae230083e49c HTTP/2\r\n
Host: mediaweb.ap.panopto.com\r\n
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0\r\n
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\r\n
Accept-Language: en-GB,en;q=0.5\r\n
Accept-Encoding: gzip, deflate, br\r\n
Referer: https://mediaweb.ap.panopto.com/Panopto/Pages/Sessions/List.aspx?embedded=1\r\n
Connection: keep-alive\r\n
Cookie: ...
\r\n

{...} (entity body)

Notes:

Response

  1. Status line (status code)
  2. Header lines
  3. Carriage return
  4. Response data
HTTP/2 200 OK\r\n
date: Fri, 21 Jan 2022 01:17:02 GMT\r\n
content-type: text/html; charset=utf-8\r\n
content-length: 32750\r\n
cache-control: private, no-store\r\n
content-encoding: gzip\r\n
vary: Accept-Encoding\r\n
\r\n

{...} (data)

Cookies

Main method of saving state (despite statelessness of HTTP).

  1. Cookie header line of response message (from server to unique end system)
  2. Cookie header line of end system’s next HTTP request
  3. End system’s local storage of cookie file
  4. Backend database of the website storing the cookies

Cookies

set-cookie cookie
set-cookie cookie

Web-caches

Satisfy client request without involving origin server.

When client makes a request:

Advantages:

Conditional GET

  1. Client process $\rightarrow$​ Server process: if-modified-since: <date>
  2. Server process $\rightarrow$​ Client process: If cached copy is not modified since, HTTP/1.0 304 Not modified otherwise contains most updated data.

No object transmission delay, less link utilization.

Domain name system (DNS)

Host identifiers: IP address (32 bit), name (human readable string). These two must be mapped to each other uniquely.

Distributed storage of this mapping

DNS

DNS

A network domain is an administrative grouping of multiple private computer networks or local hosts within the same infrastructure.

– Wikipedia (https://en.wikipedia.org/wiki/Network_domain)

Client searches for www.amazon.com.

  1. Client queries root server for .com DNS server
  2. Client queries .com DNS server for amazon.com DNS server.
  3. Client queries amazon.com DNS server for www.amazon.com

Levels of DNS Servers

Local DNS Server

  1. Host makes DNS query
  2. Query first sent to local DNS server
  3. Search local cache of name-address pairs
  4. Forwards query (as a proxy) into the

Does not belong to the hierarchy of distributed database that stores mapping permanently.

Root DNS Server

Iterated query

Local DNS server receives the next server to contact from the previous server, and calls them one by one until the authoritative DNS is found.

Iterated Query

Recursive query

Local DNS server requests for the authoritative DNS from the root DNS server, where if it isn’t cached, requests from the TLD, which if it isn’t cached, it requests from the next level domain etc. and passes the information back to the local DNS server.

Recursive Query

This is problematic:

Caches

Satisfies client request without involving origin server.

Once (any) name server learns mapping, it caches mapping, but mappings expire after some Time To Live (TTL).

Cached entries might be out of date. (If a named host changes IP address, this won’t be universally known until all TTLs expire.)

Response failure?