Proxy Server (Web Caching)

 

Proxy Server (Web Caching)

Introduction

A proxy server is an intermediate computer that sits between a client (browser) and a web server. It stores copies of recently requested web pages (cached responses) and serves them to clients when the same content is requested again.

HTTP supports the use of proxy servers to improve web performance and reduce network traffic.


Definition

A proxy server is an intermediary server that stores copies of frequently requested web pages and provides them to clients without always contacting the original web server.


Need for a Proxy Server

Without a proxy server:

Client → Internet → Web Server

Every request is sent directly to the web server.

With many users requesting the same web page:

  • Network traffic increases.
  • Server load increases.
  • Response time becomes longer.

A proxy server solves these problems by caching web pages.


Working of a Proxy Server

The proxy server receives all client requests first.

Case 1: Requested page is available in cache (Cache Hit)

  1. Client sends request to proxy server.
  2. Proxy checks its cache.
  3. Cached copy is found.
  4. Proxy immediately sends the page to the client.

The original web server is not contacted.


Case 2: Requested page is not available (Cache Miss)

  1. Client sends request to proxy server.
  2. Proxy checks its cache.
  3. Requested page is not found.
  4. Proxy acts as a client and forwards the request to the web server.
  5. Web server sends the requested page.
  6. Proxy stores a copy in its cache.
  7. Proxy forwards the page to the client.

Working Diagram

Cache Hit

Client
   |
HTTP Request
   |
Proxy Server
(Cache contains page)
   |
HTTP Response
   |
Client

Cache Miss

Client
   |
HTTP Request
   |
Proxy Server
   |
HTTP Request
   |
Web Server
   |
HTTP Response
   |
Proxy stores copy
   |
HTTP Response
   |
Client

Proxy Server Acts as Both Client and Server

One unique feature of a proxy server is that it performs two different roles.

Acts as a Server

When the requested page is available in the cache:

  • Receives request from the client.
  • Sends the cached response.

Acts as a Client

When the page is not in the cache:

  • Sends a request to the original web server.
  • Receives the response.
  • Stores a copy.
  • Sends the response to the client.

Thus, a proxy server behaves as both:

  • Server for the browser.
  • Client for the web server.

Advantages of Proxy Servers

1. Reduces Server Load

Frequently requested pages are served from the cache instead of repeatedly contacting the original server.


2. Reduces Network Traffic

Only the first request travels through the Internet.

Subsequent requests are served locally.


3. Improves Response Time (Lower Latency)

Cached pages are delivered much faster than downloading them from remote servers.


4. Saves Internet Bandwidth

Less data is transferred over the Internet.

This is especially useful for organizations and ISPs.


5. Improves Overall Network Performance

Multiple users requesting the same page receive faster responses.


Limitations of Proxy Servers

  • Cached pages may become outdated.
  • Proxy requires additional storage.
  • Clients must be configured to use the proxy server.

Location of Proxy Servers

Proxy servers are generally installed close to users.

1. Client Computer

A browser may cache frequently visited pages locally.

User
   |
Local Browser Cache

2. Organization or Campus Network

A proxy server is installed inside the LAN.

All users share the same cache.

Clients
    |
Campus Proxy Server
    |
Internet

3. Internet Service Provider (ISP)

Large ISPs install proxy servers for thousands of users.

Users
    |
ISP Proxy Server
    |
Internet

Example

Consider a college network.

  • Student A visits www.example.com.
  • The proxy downloads the page and stores it.
  • Later, Student B requests the same page.
  • Instead of contacting the Internet again, the proxy sends the cached copy.

Benefits:

  • Faster access.
  • Reduced Internet usage.
  • Lower server load.



Cache Updating

A cached web page cannot remain in the proxy forever because web content changes.

Therefore, the proxy periodically updates or removes old pages.

Example

A news website updates its homepage every morning.

The proxy server:

  • Downloads the latest page in the morning.
  • Serves that cached page throughout the day.
  • Replaces it with a new copy the next day.

This ensures users receive reasonably up-to-date content while still benefiting from caching.


Summary

FeatureDescription
Definition    Intermediate server that caches web pages
Purpose    Reduce server load and improve performance
Cache Hit    Page served directly from cache
Cache Miss    Proxy fetches page from original server
Roles    Acts as both client and server
Benefits    Faster access, reduced latency, lower bandwidth usage, reduced server load
Common Locations    Client computer, organization LAN, ISP network

Comments

Popular posts from this blog

Computer Networks PCCST501 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Computer Networks

Introduction to Local Area Network (LAN)