Web Programming I (Python) 2021 (Overview of HTTP and Related Technologies)
Web Programming I (Python) 2021 (Overview of HTTP and Related Technologies)
Related Technologies
Lecture 01
Learning Outcomes
After completing this lesson, you should be able to
it is a client-server protocol
It is used to not only fetch resources, but also to post content to servers, like
with HTML form results
HTTP can also be used to fetch parts of documents to update Web pages on
demand
HTTP
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
HTTP
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
HTTP
HTTP is a client-server protocol including the following high-level components
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
HTTP
Question: List example clients
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
HTTP
Requests are sent by the user-agent (or a proxy on behalf of it)
Other user-agents
Web crawlers
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
HTTP
The server serves the documents requested by the client
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
HTTP
Between the client and the server there are numerous entities, collectively
called proxies
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
HTTP
HTTP is stateless but not sessionless
Using HTTP cookies allows you to link requests with the state of the server
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
Evolution of HTTP
List of different version of HTTP
HTTP/0.9
HTTP/1.0
HTTP/1.1
HTTP/2
HTTP/3
HTTP/0.9
Client-server, request-response protocol
The connection between server and client is closed after every request and
response
HTTP/1.0: Example
Request line with HTTP
1
version number, followed by
request headers
Request Line
Request Header
Response Line
Response Header
Question
What do you think are the limitations of the HTTP/1.0 protocol ?
HTTP/1.0: Limitations
Requiring a new TCP connection per request
imposes a significant performance penalty
HTTP/1.1
Standardized protocol
The official HTTP/1.1 standard is defined in RFC 2068, which was released in
January 1997
Keepalive Connections
Request Pipelining
Transfer Encoding
Byte-range Requests
Host header
6
Inform server that the
connection will not be reused
HTTP/1.1: Example
7 Icon response, followed by connection close
Question
What is the name of the header part that is added on HTTP/1.1 version to
improve the limitation of HTTP/1.0 (requiring a new TCP connection for each
request)
Question
What do you think are the limitations of the HTTP/1.X protocol ?
Limitations of HTTP/1.x
Clients need to use multiple connections to achieve concurrency and
reduce latency
Does not allow effective resource prioritization, resulting in poor use of the
underlying TCP connection
SPDY
SPDY was an experimental protocol, developed at Google and announced in
mid-2009
Its primary goal was to try to reduce the load latency of web pages by
addressing some of the well-known performance limitations of HTTP/1.1
SPDY
The specific project goals were the following
As a result SPDY was supported in Chrome, Firefox, and Opera, and a rapidly
growing number of sites e.g., Google, Twitter, Facebook
SPDY and HTTP/2
Observing the trend, the HTTP Working Group (HTTP-WG) kicked off a new
effort
Single digit %
perf improvement
after
5 Mbps
Linear
improvement in
page load time!
Latency vs Bandwidth impact on Page Load Time
Decreasing latency has more impact than increasing bandwidth
For Example
Decreasing RTTs from 150 ms to 100 ms have a larger effect on the speed
of the internet than increasing a user’s bandwidth from 3.9 Mbps to 10
Mbps or even 1 Gbps
HTTP/2:Streams, Messages, and Frames
The introduction of the new binary framing mechanism changes how the data
is exchanged between the client and server
Stream
Message
RST_STREAM to cancel
HTTP/2: Binary framing
Each frame has a common header
In HTTP/1.x, this metadata is always sent as plain text and adds anywhere
from 500–800 bytes of overhead per transfer, and sometimes kilobytes
more if HTTP cookies are being used
Single TCP
Multiple Stream
Browsers Supporting HTTP/2
https://caniuse.com
Limitations of HTTP/2
What are the limitations of HTTP/2 protocol?
Limitations of HTTP/2
One of the larger issues with HTTP/2 on top of TCP is the issue of
head-of-line blocking
When a TCP packet is lost, no streams on that HTTP2 connection can make
forward progress until the packet is retransmitted and received by the other
side - not even when the packets with data for these streams have arrived and
are waiting in a buffer
QUIC
QUIC (Quick UDP Internet Connections) is a new transport protocol for the
internet, developed by Google
Connection migration
QUIC: Low Connection establishment latency
QUIC handshakes frequently require zero roundtrips before sending
payload, as compared to 1-3 roundtrips for TCP+TLS
QUIC: Congestion Control
QUIC has pluggable congestion control, and provides richer information to
the congestion control algorithm than TCP
If one of the packets in the group is lost, the contents of that packet can be
recovered from the FEC packet and the remaining packets in the group
QUIC: Connection Migration
QUIC connections are identified by a 64 bit connection ID, randomly
generated by the client.
This means that if a client changes IP addresses (for example, by moving out
of Wi-Fi range and switching over to cellular) or ports (if a NAT box loses and
rebinds the port association), any active TCP connections are no longer valid
When a QUIC client changes IP addresses, it can continue to use the old
connection ID from the new IP address without interrupting any in-flight
requests
HTTP/3: HTTP over QUIC
Instead of using TCP as the transport layer for the session, it uses QUIC
QUIC streams are delivered independently such that in most cases packet
loss affecting one stream doesn't affect others
HTTP/3: HTTP over QUIC
The transport security used in QUIC is using TLS 1.3 (RFC 8446) and there are
never any unencrypted QUIC connections
HTTP Messages
HTTP messages, as defined in HTTP/1.1 and earlier, are human-readable
Even if only part of the original HTTP message is sent in HTTP/2, the
semantics of each message is unchanged and the client reconstitutes the
original HTTP/1.1 request
POST
DELETE
PATCH
The HEAD method asks for a response identical to that of a GET request,
but without the response body
OPTIONS
POST , PUT , and DELETE methods are not safe as they change the state of the
server
HTTP Idempotent Request Methods
A method is considered idempotent if the state of the server doesn’t
change the second time the method is called with the same data
WebAssembly (Wasm)
https://webassembly.org/
Reference
https://hpbn.co/
https://developers.google.com/web/fundamentals/performance/http2
https://developer.mozilla.org/en-US/docs/Web/HTTP/