Jerry's Blog

Recording what I learned everyday

View on GitHub


28 September 2019

Network(10) -- The Web and HTTP

by Jerry Zhang

Overview of HTTP

The HyperText Transfer Protocol (HTTP), the Web’s application-layer protocol, is at the heart of the Web.

A Web page (also called a document) consists of objects. An object is simply a file—such as an HTML file, a JPEG image, a Java applet, or a video clip—that is addressable by a single URL. Most Web pages consist of a base HTML file and several referenced objects.

HTTP uses TCP as its underlying transport protocol.

It is important to note that the server sends requested files to clients without storing any state information about the client. HTTP is said to be a stateless protocol.

Non-Persistent and Persistent Connections

Should each request/response pair be sent over a separate TCP connection, or should all of the requests and their corresponding responses be sent over the same TCP connection? In the former approach, the application is said to use non-persistent connections; and in the latter approach, persistent connections.

Although HTTP uses persistent connections in its default mode, HTTP clients and servers can be configured to use non-persistent connections instead.

HTTP with Non-Persistent Connections

Each TCP connection is closed after the server sends the object—the connection does not persist for other objects.

Most browsers open 5 to 10 parallel TCP connections, and each of these connections handles one request-response transaction.

The total response time is two RTTs plus the transmission time at the server of the HTML file.

tags: Network