190 likes | 331 Views
IERG 4180 Tutorial 6 Lei Deng 2013-10-30/2013-11-01. Some contents are from the Internet. Some Reminders. Please submit your declaration form to us for your project 2. Either is OK: Hard Copy Soft copy to Jim’s email, nhw013@ie.cuhk.edu.hk. HTTP: Introduction.
E N D
IERG 4180 Tutorial 6 Lei Deng2013-10-30/2013-11-01 Some contents are from the Internet
Some Reminders • Please submit your declaration form to us for your project 2. Either is OK: • Hard Copy • Soft copy to Jim’s email, nhw013@ie.cuhk.edu.hk
HTTP: Introduction • HTTP: HyperTextTransfer Protocol • Rules for request-response transfer between web servers (web sites) and web clients (web browser) • HTML: HyperTextMarkup Language • Definitions of tags that are integrated into web text documents to control their appearance • Language of the Web • Foundation of data communication for the World Wide Web (WWW)
HTTP: History • HTTP/0.9 – 1991 • Created by Tim Berners-Lee, along with HTML • Only GET and HTML • HTTP/1.0 – 1995 • RFC 1945 • Meta-information,Caching, Authorization, etc. • HTTP/1.1 - 1999 • RFC 2616 • Byte ranges, Chunked encoding, Content Negotiation, Protocol switching, Digest authentication, etc.
HTTP: Layer HTTP is an application layer protocol Transport Protocol: TCP Known port: 80
I would like to open a connection GET <file location> Display response Close connection OK Send page or error message OK HTTP: A Conversation Example Client Server
HTTP: URI • URI: Uniform Resource Identifiers • provide a simple and extensible means for identifying a resource • Include URN (Uniform Resource Name) and URL (Uniform Resource Locator) • Examples: • ftp://ftp.is.co.za/rfc/rfc1808.txt • http://www.math.uio.no/faq/compression-faq/part1.html • mailto:mduerst@ifi.unizh.ch • telnet://melvyl.ucop.edu/
HTTP: URI • URI with scheme HTTP • syntax: • "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]] • Same URIs in HTTP • http://abc.com:80/~smith/home.html • http://ABC.com/%7Esmith/home.html • http://ABC.com:/%7esmith/home.html
HTTP: Methods • GET • retrieve a HTTP URI from the server • The only one required in Project 3! • OPTIONS, HEAD, POST, PUT, DELETE, TRACE, CONNECT
HTTP: Request • Format: <request-line><general-headers><request-headers><entity-headers><empty-line>[<message-body>][<message-trailers>] • request-line Method SP Request-URI SP HTTP-Version CRLF • Examples: • GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1 • GET /pub/WWW/TheProject.html HTTP/1.1 Host: www.w3.org
HTTP: Request Examples
HTTP: Response • Format: <status-line> <general-headers> <response-headers> <entity-headers> <empty-line> [<message-body>] [<message-trailers>] • Status-line HTTP-Version SP Status-Code SP Reason-Phrase CRLF • Message-body • html file, video, image, etc. • Only text html file required in Project 3!
HTTP: Response • Status Code • 1xx: Informational - Request received, continuing process • 2xx: Success - The action was successfully received, understood, and accepted • 3xx: Redirection - Further action must be taken in order to complete the request • 4xx: Client Error - The request contains bad syntax or cannot be fulfilled • 5xx: Server Error - The server failed to fulfill an apparently valid request
HTTP: Response Example:
HTTPERF: Introduction httperf is a tool for measuring web server performance by generating various HTTP workloads Free GNU software Only for Linux system Support HTTP/1.1
HTTPERF: How to Build • I tried sourceforge version but cannot build. And 0.9.0 version works from ftp://ftp.hpl.hp.com/pub/httperf/. • SRCDIR refers to the httperf source directory • e.g., /home/dlll/httperf-0.9.0/httperf-0.9.0 • Build Batch • $ mkdir build • $ cd build • $ SRCDIR/configure • $ make • $ make install (may need root access)
HTTPERF: Test Example • httperf --hop Use as many TCP ports as possible --server www.cuhk.edu.hk Specify the sever --port 80 Specify the port --uri/english/index.html The file you want to download --rate 400 The rate in requests/second --num-conn 8000 The total number of TCP Connections --timeout 20 The request will fail if it takes longer than this
HTTPERF: Resources • HP httperf Homepage: • http://www.hpl.hp.com/research/linux/httperf/ • httperf source packages: • http://sourceforge.net/projects/httperf/ • ftp://ftp.hpl.hp.com/pub/httperf/ • Ted Bullock's httperfpage • http://www.comlore.com/httperf.html