Computer Network/컴퓨터네트워크

[컴퓨터네트워크] 2. Application Layer (2)

leziwn.cs 2023. 9. 28. 18:40
Non-persistent HTTP 
  1. TCP connection opened.
  2. One object sent over TCP connection.
  3. TCP connection closed. (Server closed)

--> Downloading multiple objects requires multiple connections. (TCP 열고, 받아오고, 닫고 ...)

1) Pipelining (x)

: 하나의 object를 받기 위해 매번 2RTT가 필요하다. --> 2RTT + 4*(2RTT)

1) Pipelining (x)

 

2) Pipelining (o)

: Parallel TCP connection --> 4RTT

2) Pipelining (o)

 

Persistent HTTP
  1. TCP connection opened.
  2. Multiple objects can be sent over a single TCP connection between client and that server.
  3. TCP connection closed.

--> 하나의 connection으로 multiple object를 보낼 수 있다.

Persistent HTTP

 


HTTP request message
General format

HTTP request message: General format

 

Two types of HTTP messages: request, response
  • HTTP request message: ASCII (human readable format)
1) HTTP request message

1) HTTP request message

▶ Request line: method, sp, URL, sp, version, cr, lf

  • method(request): GET
    **method 종류 
         - GET
         - POST(client가 web server에 뭔가를 올릴 때: Body에 데이터를 실어서 보낸다.)
         - HEAD(데이터x, response만 보내줘)
  • URL(file의 위치): index.html HTTP
  • version: 1.1

▶ Header lines: header file name, value, cr, lf

  • Host: www-net.xs.umass.edu\r\n --> server host의 domain name
  • User-Agent: Firefox/3.6.10\r\n --> browser의 종류, 버전
  • Accept: text/html, application/xhtml+xml\r\n --> accept 종류
  • Accept-Language: en-us, en; q=0.5\r\n --> Language
  • Accept-Encoding: gzip, deflate\r\n --> Encoding
  • Accept-Charset: ISO-8859-1, utf-8; q=0.7\r\n
  • Keep-Alive: 115\r\n --> 115번 보낼 동안 Persistent TCP connection 
  • Connection: keep-alive\r\n
  • \r\n

 

2) HTTP response message

▶ Status line

  • HTTP/1.1 200 OK \r\n --> web server의 HTTP, OK

▶ Header lines

  • Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
  • Server: Apache/2.0.52 (CentOS) \r\n --> server의 종류
  • Last-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\n --> web page가 마지막으로 업데이트된 시간
  • ETag: "17dc6-a5c-bf716880"\r\n
  • Accept-Ranges: bytes\r\n
  • Content-Length: 2652\r\n --> 보내는 길이
  • Keep-Alive: timeout=10, max=100\r\n --> Persistent TCP, 시간: 10초, 100개
  • Connection: Keep-Alive\r\n
  • Content-Type: text/html; charset=ISO-8859-1\r\n --> 보내는 정보: text html
  • \r\n

▶ Data (ex. requested HTML file)

  • data data data data ... 

 

HTTP response - status codes

HTTP response - status codes

 


HTTP cookies

: Web sites and client browser use cookies to maintain some state between transactions.

 

▶ Four components:

  • set-cookie header line of HTTP response message
  • cookie header line in next HTTP request message
  • cookie file kept on user's host, managed by user's browser
  • back-end database at Web site

 

▷ 예시: Susan uses brower on laptop, visits specific e-commerce site for the first time.

  1. When initial HTTP request arrives at site, site creates:
    - unique ID (cookie)
    - entry in back-end database for the ID (cookie)
  2. Subsequent HTTP requests from Susan to this site will contain cookie ID value, allowing site to identify Susan.
    (그 다음부터의 request: header line에 cookie를 붙여서 request한다.)

 

Maintaining user/server state

Maintaining user/server state: cookies

  1. First request message: response message, set cookie.
    --> client: cookie file에 저장
    --> server: backend database에 저장
  2. Second request message: backend database에 접근하여, cookie-specific response message.

--> 첫 번째 request message 이후에는 사용자에 대한 cookie가 생성되어 cookie specific action을 취한다.

 

Comments

▷ What cookies can be used for:

: Protocol 자체는 independent하게 처리한다. But, cookie 덕분에 backend database에 cookie 정보가 저장되어 있어서, cookie specific action이 가능해진다.

  • authorization
  • shopping carts
  • recommendations
  • user session state (Web e-mail) 

 

▷ Challenge: How to keep "state":

  • Protocol endpoints: maintain state at sender/receiver over multiple transactions.
  • Cookies: http messages carry state.

 

▷ Cookies and Privacy:

  • Cookies permit sites to learn a lot about you on their site.
  • Third party persistent cookies (tracking cookies) allow common identity (cookie value) to be tracked across multiple web sites.

 


Web caches (proxy server)

▷ Goal: Origin server에 접근하지 않고 client의 request를 만족시키는 것

  • 브라우저가 web cache를 거쳐야 한다는 configuration이 필요하다.

Web caches (proxy server)

▶ Browser sends all HTTP requests to cache

  • Web cahce에 object가 있을 때 --> cache returns object to client.
  • Web cache에 object가 없을 때 --> cache requests object from origin server, caches received object, then returns object to client.

 

More about Web caching
  • Web cache acts as both client and server.
    - Server for original requsting clinet.
    - Client for origin server.
  • Typically, cache is installed by ISP. (university, company, residential ISP)

▶ Why Web caching?

  • Reduce response time for clinet request.
  • Reduce traffic on an institution's access link. (server로의 traffic을 감소시킨다.)
  • Internet dense with caches. ("poor" content provider가 더 효율적으로 동작하도록 한다.)
  • Auditing, Access control, ...

▶ Concerns of Web caching

: Cache inconsistency

 

Caching Motivation (Web cache의 장점)

  • End-to-end delay = Internet delay + Access link delay + LAN delay

 

Solution 1) Buy a faster access link

: Access link에서의 속도를 빠르게 하는 방법

  • 단점: faster access link is expensive!

Solution 1) Buy a faster access link

 

Solution 2) Install a web cache

: LAN 내에서 response를 받는 방법 -- web cache

  • 장점: web cache is cheap!

 

Conditional GET

▷ Problem: Cache inconsistency

▷ Solution: Conditional GET

--> Server does not send object if cache has up-to-date cached version.

Conditional GET

▷ Object not modified after <date>

  1. Proxy server: If-modified-since: <data>
  2. Origin server: HTTP/1.0 304 Not Modified

▷ Object modified after <date>

  1. Proxy server: If-modified-since: <data>
  2. Origin server: HTTP/1.0 200 OK <data> --> OK, data를 실어서 보낸다.

 

▶ Web cache: specify data of cached copy in HTTP request.

  • If-modified-since: <data>

▶ Server: response contains no object if cached copy is up-to-date.

  • 304 Not Modified

 


HTTP/2

▶ HTTP 1.1: Non-persistent HTTP (single TCP connection)

- FCFS(First Come First Served): server responds in-order to GET requests.

  • Problem 1) head-of-line (HOL) blocking: 앞에 있는 object가 너무 커서, 뒤의 request가 기다리는 문제
  • Problem 2) loss recovery stalls object transmission.

 

▶ HTTP/2 - Solution: 

  • methods, status codes, most header fields unchanged from HTTP 1.1.
  • object priority (not necessarily FCFS)
  • Server: push unrequested object to client.
  • object를 frame으로 자른다. --> HOL blocking 문제 해결 (긴 object가 막고 있어서 transmission이 끊기는 문제)

 

Mitigating HOL blocking

HTTP 1.1 --> HTTP/2

 

HTTP/3

▷ Goal: Decreased delay in multi-object HTTP requests.

 

▶ HTTP/2:

- HTTP/2 over single TCP

  • Problem 1) loss recovery stalls object transmission.
  • Problem 2) no security

 

▶ HTTP/3 - Solution: 

  • Solution1) UDP: loss recover (x) --> no stall
  • Solution 2) security 기능 추가