150 likes | 165 Views
Understand Web caching and CGI concepts to optimize web access, reduce response time, and enable dynamic content generation. Learn how caching can improve performance and the role of CGI in server-side web programming.
E N D
user sets browser: Web accesses via cache browser sends all HTTP requests to cache object in cache: cache returns object else cache requests object from origin server, then returns object to client HTTP request HTTP request HTTP response HTTP response HTTP request HTTP response Web caches (proxy server) goal: satisfy client request without involving origin server proxy server client origin server client origin server Application Layer
cache acts as both client and server server for original requesting client client to origin server typically cache is installed by ISP (university, company, residential ISP) why Web caching? reduce response time for client request reduce traffic on an institution’s access link Internet dense with caches: enables “poor” content providers to effectively deliver content (so too does P2P file sharing) More about Web caching Application Layer
Caching example: assumptions: • avg object size: 100K bits • avg request rate from browsers to origin servers:15/sec • avg data rate to browsers: 1.50 Mbps • RTT from institutional router to any origin server: 2 sec • access link rate: 1.54 Mbps consequences: • LAN utilization: 15% • access link utilization = 99% • total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + usecs origin servers public Internet problem! 1.54 Mbps access link institutional network 1 Gbps LAN Application Layer
Caching example: fatter access link assumptions: • avg object size: 100K bits • avg request rate from browsers to origin servers:15/sec • avg data rate to browsers: 1.50 Mbps • RTT from institutional router to any origin server: 2 sec • access link rate: 1.54 Mbps consequences: • LAN utilization: 15% • access link utilization = 99% • total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + usecs origin servers public Internet 154 Mbps 1.54 Mbps access link 154 Mbps 0.99% institutional network 1 Gbps LAN msecs Cost: increased access link speed (not cheap!) Application Layer
Caching example: install local cache local web cache assumptions: • avg object size: 100K bits • avg request rate from browsers to origin servers:15/sec • avg data rate to browsers: 1.50 Mbps • RTT from institutional router to any origin server: 2 sec • access link rate: 1.54 Mbps consequences: • LAN utilization: ? • access link utilization = ? • total delay = Internet delay + access delay + LAN delay = ? + ? + ? origin servers public Internet 1.54 Mbps access link institutional network 1 Gbps LAN Cost: web cache (cheap!) Application Layer
Goal: don’t send object if cache has up-to-date cached version no object transmission delay lower link utilization cache: specify date of cached copy in HTTP request If-modified-since: <date> server: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not Modified HTTP response HTTP/1.0 304 Not Modified Conditional GET server client HTTP request msg If-modified-since: <date> object not modified before <date> HTTP request msg If-modified-since: <date> object modified after <date> HTTP response HTTP/1.0 200 OK <data> Application Layer
Need for CGI • HTML/XHTML is static, it is not parameterized; • using only HTML/XHTML, CSS and JS one can not write dynamic web pages: pages that look differently depending on the user who visit it (client, administrator etc.), pages that display different products depending on what is in a database, pages that should be displayed depending on the value of some parameters. • using only HTML/XHTML, CSS and JS one can not develop distributed web applications (e-commerce sites, hotel booking, web search applications etc.)
What is CGI? • Common Gateway Interface (CGI) is a standard method used to generate dynamic content on Web pages and Web applications. CGI, when implemented on a Web server, provides an interface between the Web server and programs that generate the Web content. TransportLayer
What is CGI? • a standard protocol for interfacing external application software with the web server • developed in 1993 at NCSA (National Center for Supercomputing Applications) • CGI 1.1 specified in RFC 3875, 2004 • allows an external executable file to respond to an HTTP Request from the browser • CGI defines how information is passed from the web server to the executable program and how information is passed from this back to the server
Server-side web programming • the HTTP Response consists of the output of an exernal program located on the server machine: HTTP Request Server-side Request HTTP Response Response Header + Html file browser executable file/CGI, php file, jsp file, asp file web server
Relative Programs and Files Web server Client Script Form CGI program
Questions These slides are adapted from Computer Networking: A Top Down Approach Jim Kurose, Keith RossAddison-WesleyMarch 2012