Chapter 2 Application Layer
Chapter 2 Application Layer
Application Layer
Tanjia Chowdhury
Assistant Professor
Southern University Bangladesh
Application Layer
The application layer in the OSI model is the closest layer to
the end user which means that the application layer and end
user can interact directly with the software application. The
application layer programs are based on client and servers.
The Application layer includes the following functions:
• Identifying communication partners: The application
layer identifies the availability of communication partners
for an application with data to transmit.
• Determining resource availability: The application layer
determines whether sufficient network resources are
available for the requested communication.
• Synchronizing communication: All the communications
occur between the applications requires cooperation which
is managed by an application layer.
Chapter 2: outline
• Stateless: HTTP is a stateless protocol as both the client and server know
each other only during the current request. Due to this nature of the
protocol, both the client and server do not retain the information between
various requests of the web pages.
HTTP overview
HTTP connections
Http 1.0 is a non-persistent connection, and http 1.1 is persistent
connection.
Basic Pre-Requisite
The terminology which we must know before going deep into Persistent & Non-Persistent
Connections is
1.RTT(Round Trip Time)
2.TCP 3-Way Handshake
1. RTT: Time for a small packet to travel from client to server and back.
RTT = 2 X propagation time
1. For a connection Persistent or Non-persistent it is sure that to initiate a TCP connection one
RTT is used.
2. One RTT is used for the HTTP request and the first few bytes to the HTTP response to return.
So to know the total file transmission time.
Total = 2RTT + transmit time
2. TCP 3-Way Handshake: TCP Connection establishes in 3 ways, that’s why it is called a 3-
way Handshake.
•Requesting the server for the connection.
•The server responds to whether the connection can be established or not.
•Acknowledgment by the client on the response sent by the server.
Round trip time(RTT)
Persistent HTTP does not require 2 RTT (round trip time) for each object that is to be
transmitted. After a successful opening of the TCP connection (opening of TCP
connection is done by 3-Way Handshaking which takes 1 RTT),
each object will require only 1 RTT to be transmitted.
HTTP request message
• two types of HTTP messages: request,
response
• HTTP request message: ASCII (human-
readable format)
General format of an HTTP request
message
Request-Line
• The Request-Line begins with a method token, followed by the
Request-URI and the protocol version, and ending with CRLF. The
elements are separated by space SP characters.
Request Method
• The request method indicates the method to be performed on the
resource identified by the given Request-URI.
Request-URl
• The Request-URI is a Uniform Resource Identifier and identifies the
resource upon which to apply the request.
Request Header Fields
• The request-header fields allow the client to pass additional
information about the request, and about the client itself, to the
server. These fields act as request modifiers.
General format of an HTTP response
message
Message Status-Line
• A Status-Line consists of the protocol version followed by a numeric status code
and its associated textual phrase. The elements are separated by space SP
characters.
HTTP Version
• A server supporting HTTP version 1.1 will return the following version information:
HTTP-Version = HTTP/1.1
User-server state: cookies
Web caches (proxy server)
• goal: satisfy client request without involving
origin server
What is Web Caching?
Storing the data to reuse it whenever it is required again is
known as web caching similar to how a web server serves a
web page to a browser. When the user first visits the page
then that page will be stored/cached and when the user visits
the next page and requests for the same page then that copy
of the web page is served from the cache, which also helps in
reducing the overload of the origin server. The delivery speed
of the page is improved by the strategies and solutions of web
caching. As a result, the backend server work is also reduced.
For ensuring that the freshest content is available in the
cache, at specific time intervals caching servers are set to be
refreshed and caching servers are also refreshed in response
to some specific events.
How a Web Caching Work?
Your website resource copy is stored at a different place which is known as a web cache.
Web cache acts as an intermediate on the web. And the job of the web cache is to sit in
between the user and the origin server and it also saves the HTTP responses sent by the
server such as HTML documents, CSS files, images, videos, etc. Web-cached responses are
referred to as representations since the original website is represented by them at a
particular point in time. Requests sent by the browser for the resources are tracked by the
web caches and then it serves them to the client. So that's why for every request it is not
required to go to the origin server. If the requested resource is accessed from the cache
then we call it cache hit. On the other hand, if the requested resource is not accessed
from the cache means the cache is not able to fulfil the request of the resource then we
call it a cache miss. Mostly in every case, we want that there is a high cache hit ratio, high
cache hit ratio means most HTTP requests are retrieved from the cache and fulfilled by the
cache.
Proxy Servers Vs Web Caching
Conclusion
• The proxy server is generally used to work as a Gateway between the internet and the user.
The proxy server is used as an intermediary server as it separates the end users from the
different websites they browse according to their requirements.
• Security and private browsing are some of the advantages of the proxy server.
• Storing the data to reuse it is known as web caching like a web server served web page is
stored.
• When the user first visits the page then that page will be stored/cached and when the user
visits the next page and requests for the same page then that copy of the web page is served
from the cache, which also helps in reducing the overload of the origin server.
• Reduced Server workload, reduced network traffic, and reduced bandwidth consumption are
the advantages of web caching.
FTP
•FTP stands for File transfer protocol.
•FTP is a standard internet protocol provided by TCP/IP used for transmitting
the files from one host to another.
•It is mainly used for transferring the web page files from their creator to the
computer that acts as a server for other computers on the internet.
•It is also used for downloading the files to computer from other servers.
Electronic mail
• Three major
components:
• user agents
• mail servers
• simple mail transfer
protocol: SMTP
• User Agent
“mail reader”
• composing, editing, reading mail messages
e.g., Outlook, Thunderbird, iPhone mail client
• outgoing, incoming messages stored on server
• The keyword smtp_crlf or smtp means that
lines must be terminated with a carriage
return (CR) line feed (LF) sequence.