- Количество слайдов: 24
Web Hosting Herng-Yow Chen
Outline n n n How different web site can be “virtually hosted” on the same server, and how this affects HTTP How to make web sites more reliable under heavy traffic How to make web site load faster
A Simple Example : Dedicated Hosting Irene’s ISP www. joes-hardware. com Content Joe client Internet www. cajun-gifts. com www. marys-antiques. com Content client Mary www. irenes-isp. com
Virtual Hosting Irene’s ISP Content www. joes-hardware. com www. marys-antiques. com Joe Content client Internet www. cajun-gifts. com client www. irenes-isp. com Mary
Virtual server request lacks Host information
Virtual Server Request Lacks Host Information (A getting http: //www. joeshardware. com/index. html) GET /index. html HTTP/1. 0 User-agent: Super. Browser v 1. 3 Client A www. voting-info. gov www. joes-hardware. com www. marys-antiques. com Internet /voting /mary /joe Client B GET /index. html HTTP/1. 0 User-agent: Web. Surfer 2000 (B getting http: //www. marys-antiques. com/index. html) HTTP/1. 0 requests do not contain hostname information, so they do not support web servers that host multiple web sites. (HTTP/1. 1 supports a Host header to fix this problem)
Making virtual hosting work n n Virtual hosting by by URL path port number IP address Host header
Virtual hosting by URL path n http: //www. joes-hardware. com/joe/index. html n http: //www. marys-antiques. com/mary/index. html n The problem?
Virtual hosting by port number n Install multiple HTTP servers one listens 80 one listens 81, and so on. n The problem? n n
Virtual hosting by IP address n Multiple IPs are assigned to single computer. Different IP corresponds to different host. n The problem? n
Virtual hosting by IP address www. voting-info. gov=209. 172. 34. 2 www. joes-hardware. com=209. 172. 34. 3 www. marys-antiques. com=209. 172. 34. 4 Dest IP address 209. 172. 34. 2 209. 172. 34. 3 209. 172. 34. 4 Directory /voting /joe /mary 209. 172. 34. 3 Client A Internet /voting /mary /joe 209. 172. 34. 4 Client B
Virtual hosting by Host header n n HTTP/1. 1 solution Use single IP, single port to serve incoming HTTP requests to different hosts.
Virtual hosting by Host header (A getting http: //www. joeshardware. com/index. html) GET /index. html HTTP/1. 1 User-agent: Super. Browser v 1. 3 Host: www. joes-hardware. com Client A www. voting-info. gov www. joes-hardware. com www. marys-antiques. com Internet /voting /mary /joe Client B GET /index. html HTTP/1. 1 User-agent: Web. Surfer 2000 Host: marys-antiques. com (B getting http: //www. marys-antiques. com/index. html) The HTTP Host header carries the hostname information that would otherwise be lost in normal server requests, allowing name-based virtual hosting
HTTP/1. 1 Host Headers n n Syntax and usage Missing Host headers Interpreting Host headers and proxies
Making web sites reliable n There are several times during which web sites commonly break: n n Server downtime Traffic spikes Network outages or losses Some ways of anticipating and dealing with the problems n n Mirrored server farms Content distribution networks
Mirrored server farms n HTTP redirection n DNS redirection n Discussed in Chapter 20.
Mirrored Server Farms Client Replica origin server Client Internet Client Switch Master origin server Replica origin servers
Mirrored Server Farms (cont. ) Chicago (HQ) Master origin server New York Replica origin server Internet Little Rock Replica origin server Miami Replica origin server
Content distribution networks n n Surrogate caches in CDNs Proxy caches in CDNs
Proxy Caches in CDNs Caching Proxy Client Switch Client Internet and lots of origin servers
Making web sites faster n n Many of the technologies mentioned in the previous slides also help web site load faster. Server farms and distributed proxy caches or surrogate servers distribute network traffic, avoiding congestion. Distributing the content brings it closer to end users, so that the travel time from server to client is lower. The key to speed of resource access is how requests and responses are directed from client to server and back across the Internet. (see more details in next lectures, redirection methods. ) Another approach to speeding up web sites is encoding the content for fast transporting. Namely, compressing the content. (see Transfer Encoding and Chunked Encoding for details. )
Reference n http: //www. ietf. org/rfc 3040. txt RFC 3040, “Internet Web Replication and Caching Taxonomy, ” is a reference for the vocabulary of web replication and caching applications. n http: //search. ietf. org/internet-drafts/draft-ietfcdi-request-routing-reqs-00. txt “Request-Routing Requirements for Content Internetworking. ” n Apache: The Definitive Guide Ben Laurie and Peter Lauire, O’Reilly & Associates, Inc. This book describes how to run the open source Apache web server.