Global Servers The new masters
Course so far General OS principles processes, threads, memory management OS support for networking Protocol stacks TCP/IP, Novell Netware Socket programming RPC - (NFS), CORBA, Java RMI
Global Servers Not like NFS: clients are not on the same LAN or even on the same part of the Internet Lots of network and operating system issues Support for global servers and services have become key to the future of the Internet and Operating Systems as well
The emergence of a Platform for e-commerce Based on LAMP Linux A free OS well built, well optimised Base kernel and loadable kernel modules Apache A free Webserver Very Modular Can run on several operating systems
LAMP continued MySql powerful, robust database manager which can be use to store and retrieve data Can be used in scripting languages such as PHP Supports a large number of features Data replication, table-locking, etc. PHP Hypertext Preprocessor Scripting language for the Web Supports a number of features FTP, data compression, file uploads, etc.
World Wide Web Brief History Started with the High-Energy Physics community like CERN collecting and disseminating information from various points on the Internet Big idea have one program that can display this information called a browser Uses hyperlinks to get to other sites
World Wide Web First Web browsing software demonstrated by Christmas 1990 Released for internal use at CERN in the spring of 1991 Turning point in 1993: NCSA released Mosaic - Unix-based Web browser on X window System. Also released httpd for Unix 1994 - Tim Bernes-Lee leaves CERN to found the W3 Consortium which governs the WWW standards
So what was there before!? Telnet - a remote console program FTP - popular file transfer program Gopher - document retrieval system menu-based, very complex WAIS - Wide Area Information Search high-speed remote searches of document databases server performs a search and sends back a title listing of relevant documents
So why did the World Wide Web work These other services were difficult to use Extremely difficult to work together WWW does not try to eliminate these services Integrates them into a new system
Anatomy of an URL host name path http://www.ft.com:8080/share/report/macroni.html protocol port
File Protocol Types file:///usr/local/birds/emus.gif a file on a local computer HTTP protocol http://a.remote.host/birds/emus.gif A file on an HTTP server FTP protocol ftp://a.remote.host/pub/emus.gif A file on an anonymous FTP server
Protocol Types cont d Gopher protocol gopher://a.remote.host/ Top level menu of a Gopher host Telnet protocol telnet://a.remote.host/ Telnet to a remote host
Protocol Types cont d SMTP protocol mailto:g.mapp@mdx.ac.uk Send mail to Glenford Mapp NNTP protocol news:comp.infosystems.www.providers Read recent news in a newsgroup WAIS protocol wais://a.remote.host/birds/birds_of_na? Emu WAIS search on the named document index
Well-known ports Protocol Port FTP 21 Telnet 23 Gopher 70 HTTP 80 NTTP 119 WAIS 210
Introduction to MIME types Every document served by a Web server has a type Knowing the type tells the browser how to display the document. Browser can call other applications to display the document MIME Multipurpose Internet Mail Extension used to indicate document types
Some MIME types Type Application/msword Application/x-tar Audio/x-wav Image/jpeg Text/html Text/plain Video/mpeg Video/quicktime Description Microsoft Word Format UNIX tar archive format Microsoft s wav format JPEG format Hypertext Markup Language Plain Text MPEG movie format Quicktime movie format
HTTP Terms URI Universal Resource Identifier pointer to an Internet Resource URL Universal Resource Locator URN Universal Resource Name (Not used)
HTTP Protocol Request Packet Method Request URI HTTP Version Method: to be performed on the resource Request URI: the resource the method will operate on HTTP Version: the HTTP version being used
HTTP Protocol cont d Response Packet HTTP Version Status Code Reason Phrase HTTP Version: the HTTP version being used Status Code: a 3-digit integer result code of the request Reason Phrase: A textual description of the status code
HTTP Methods GET Get a header and resource from the server GET /index.html HTTP/1.0 Response: HTTP/1.1 200 OK Rest of the header followed by the file or resource
HTTP Methods Rest of the header Date and time Server name -e.g.; Apache/2.0.33 (UNIX) Content length: length of file Content-Type: text/html Connection: close
HTTP Methods cont d HEAD just return the header and not the resource itself HEAD /index.html HTTP/1.0 POST Send information to the server POST /cgi-bin/search.cgi HTTP/1.0 Content length of the request Request are usually queries
HTTP Methods cont d OPTIONS Returns the list of methods allowed by the server OPTIONS * HTTP/1.1 Host: www.alphacomplex.com
HTTP Methods cont d TRACE Traces a request to see what a server actually sees: Looks at the effect through proxies TRACE * HTTP/1.0 Host: www.alphacomplex.com DELETE Deletes a resource on the server DELETE /document.html HTTP/1.0 not usually implemented
HTTP Methods cont d PUT Create or change a file on the server PUT /newfile.txt HTTP/1.1 Never implemented CONNECT Enables proxies to switch to a tunnelling mode for protocols like SSL
The Hypertext Markup Language (HTML) Markup Language tags are inserted in the document interpreted by the browser HTML is a subset of SGML Standard Generalized Markup Language ISO standard notation for describing text markup languages
Basic Tags <HTML> <HEAD> <TITLE> Example <\TITLE> <BODY> Body of Document <\BODY> <\HTML>
HTML cont d Heading and Header Levels <H1> THIS IS A BIG HEADING <\H1> <H2> a bit smaller <\H2> Highlights <EM> Emphasis <\EM> <STRONG> STRONG Emphasis <\STRONG> <I> Italic </I> <B> BOLD <\B>
HTML cont d Support for Tables, Lists and Frames Inserting things like images <IMG SRC= cambridge.gif BORDER=3> <IMG SRC= eg.gif WIDTH=100 HEIGHT =200 > Links <A HREF= /pictures/cow.jpg > A cow </A>
HTML cont d APPLET Java based executed at the client needs a JVM now included in most browsers
A quick Introduction to XML HTML Tags are fixed and do not describe or say anything about the relationship in the data XML attempt to support the creation of structured documents using user-defined tags
<?xml version = 1.0?> <family> Example of XML <father>joseph O. <surname>clark</surname></father> <mother> Mary J. <surname>clark</surname><maiden>jones</maiden></mother> <offspring> <child>jennifer <surname>clark</surname></child> <child>joseph O. <surname>clark</surname> II</child> </offspring> </family>
Web Servers Servers are complex pieces of software Must be supported on different operating systems How do you build a scalable server What part of the OS needs to be strengthened
Web Servers- what do they do? Serve static pages Lots of Web servers do this alone No much processing Web page is moved from disk to the network Frequently used Web pages cached in memory Spend money on fast disks rather than processing power Uses the GET method of HTTP protocol
Web Servers - what do they do? Dynamic pages Web requests are processed to create a new Web page based on the request HTTP not a programming language so some other mechanism must be invoked to do the processing Uses the POST method Common Gateway Interface (CGI) allows the server to call programs to handle the request. Different Languages supported
Scripting Languages - Perl Perl - very popular scripting language Has C-like syntax also similar to shell scripting languages Three basic structures scalars (like variables) arrays (indexed by a number) associated arrays (index by strings) Perl 5 has a more object-oriented syntax
JavaScript is NOT Java JavaScript was a scripting language from Netscape CGI - Perl scripts are executed at the server JavaScript and Java are both done at the browser side HTML allows JavaScript to run by supporting new tags such as <SCRIPT> which asks the browser to execute a function
JavaScript Support for JavaScript Objects Contains both data parts (called properties) Contains functions called methods Built-In Objects window object - top level object document object
PHP Allows the creation of Dynamic Pages Supports client-side scripting for websites Processes POST and GET Pages efficiently Integrates with databases Supports email applications Can write very powerful applications
Java Full object-oriented programming language Support for threads, synchronization Support for sockets Java code can be executed by browser using APPLET Tag Code compiled down to byte-code portable, secure
Apache Apache originally ran only on Unix Used to fork to handle new connection Assumption: - since we can saturate a 1.5 Mbps T1 line and most people cannot afford to have a T1 line then the performance of Web Server does not matter Apache 2.0 supported on more operating systems also much more modular in design
Apache 2.0 Servers divided into a set of modules CORE modules must be built into every server Optional Modules dependent on the features that the system supports Custom- built modules companies can build their own modules and load them into the Apache Server
Apache 2.0 cont d Key Module - Multi Processing Module or MPM This is a module or set of modules that decide which technique is used to service multiple requests; forks, threads, etc. Each platform can have a set of modules allowing the one best suited to a particular application to be chosen
MPM For Unix Prefork MPM uses the prefork system call which allocates resources to create several processors to handle requests (More processes can be created if needed) Worker MPM Fully threaded Apache server more lightweight than using fork faster to start and to shut down
MPM for Unix cont d Per child MPM a variation on the worker MPM a child process is forked for each virtual server the child process then uses a number of threads within the process to handle requests to that virtual host
MPMs for Windows and OS/2 Windows really does not have the concept of fork Winnt MPM single process, multi-threaded server Works fine on Windows 2000 and XP Mpmt_os2 multi-process, multi-threaded server for OS/2 each process runs a limited number of threads to handle requests.
MPMs for Other OSes Novell Netware MPM multi-threaded server on Netware platform Beos Beos MPM provides a multi-threaded server on the Beos platform
Sources for this lecture How to Set Up and Maintain a Web Site Lincoln D. Stein (Second Edition) Professional Apache 2.0 Peter Wainwright