Persistent vs Non-Persistent HTTP Connections

AwestruckYew avatar
AwestruckYew
·
·
Download

Start Quiz

Study Flashcards

10 Questions

What HTTP response status code indicates that the requested object has been moved to a new location?

301 Moved Permanently

In the context of HTTP, what does a 404 status code signify?

Requested document not found on this server

When establishing a TCP connection to an HTTP server, what is the default port used?

80

What does a 400 status code signify in the context of HTTP?

Request message not understood by server

Which HTTP version is mentioned in the request message 'GET /fee/NewsDetails/142317/en HTTP/1.1'?

HTTP/1.1

What does sending a minimal GET request involve in terms of communication with an HTTP server?

Sending a minimal but complete request via port 80

Which status code indicates that the HTTP version used in the request is not supported?

505 HTTP Version Not Supported

'ncat www.menofia.edu.eg 80' is an example of what kind of connection in the context of HTTP?

'Persistent' connection

'GET /fee/NewsDetails/142317/en HTTP/1.1' is an example of what part of an HTTP transaction?

'Request message'

'Host: www.menofia.edu.eg' is typically found in which part of an HTTP request message?

'Request header'

Study Notes

HTTP Protocol

  • Past history (state) must be maintained, and reconciled in case of server/client crashes
  • HTTP connections have two types: non-persistent and persistent

Non-Persistent HTTP

  • One TCP connection is opened and closed for each object
  • Example: user enters URL www.someSchool.edu/someDepartment/home.index containing text and references to 10 jpeg images
  • Steps:
    • HTTP client initiates TCP connection to HTTP server at port 80
    • HTTP client sends HTTP request message containing URL
    • HTTP server receives request message, forms response message, and sends message into its socket
    • HTTP server closes TCP connection
  • This process is repeated for each of the 10 jpeg objects
  • RTT (Round Trip Time) is the time for a small packet to travel from client to server and back
  • HTTP response time per object: 2RTT + file transmission time

Issues with Non-Persistent HTTP

  • Requires 2 RTTs per object
  • OS overhead for each TCP connection
  • Browsers often open multiple parallel TCP connections to fetch referenced objects in parallel

Persistent HTTP (HTTP 1.1)

  • Server leaves connection open after sending response
  • Subsequent HTTP messages between same client/server are sent over open connection
  • Client sends requests as soon as it encounters a referenced object
  • Response time is reduced to as little as one RTT for all referenced objects

HTTP Request and Response Messages

  • Two types of HTTP messages: request and response
  • HTTP request message:
    • ASCII (human-readable format)
    • Request line (GET, POST, HEAD commands)
    • Header lines
  • HTTP response message:
    • Status codes (e.g. 200 OK, 301 Moved Permanently, 400 Bad Request, 404 Not Found, 505 HTTP Version Not Supported)

Trying out HTTP (Client Side)

  • Use ncat tool to connect to a web server (e.g. www.menofia.edu.eg)
  • Type in a GET HTTP request message (e.g. GET /fee/NewsDetails/142317/en HTTP/1.1)
  • Observe the response message sent by the HTTP server

Learn about the differences between persistent and non-persistent HTTP connections in this quiz. Explore how maintaining the past history (state) is crucial, and how to reconcile inconsistent views of 'state' when servers or clients crash.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Untitled
2 questions

Untitled

SupportiveCatSEye6941 avatar
SupportiveCatSEye6941
WebSocket Usage and Differences Quiz
6 questions
HTTP Request Methods and Structure
16 questions
Use Quizgecko on...
Browser
Browser