On the Internet, you need to be alert to many Web applications, including some of the more important applications, such as HTTP servers, proxies, caches, gateways, tunnels, agent agents, trunks, and so on.
http://blog.csdn.net/bjyfb/article/details/20560177
Web server
Web developers are most exposed to Web servers, which implement HTTP and related TCP connection processing, as well as complex servers with simple Web servers. But they did the same thing: establish a connection-accept request-Process request-access resource-build response-Send response-record the transaction process.
When the Web server accepts the request message, different Web server architectures will serve the request in different ways, with the following servers:
Single-threaded Web server: Only one request is processed at a time, and the next request is processed after one transaction has finished processing.
Multi-process and multi-threaded Web servers: Assigning a thread/process to each connection consumes too much memory resources, and many thread Web servers limit the maximum number of threads/processes.
Server multiplexing I/O: In order to support a large number of connections, many Web servers use this structure, in the reuse fabric, while monitoring all connection activities, when the connection state changes (with data, or errors), the connection is assigned to the thread processing, after processing is completed, the connection is returned to the list of connections, Threads or processes are not bound on idle connections.
Multiplexed multi-threaded Web server: Combines multithreading and multiplexing.
Agent
The HTTP proxy server is both a Web server and a Web client, called the middle entity of the web, and is widely used by proxies, such as child filters, document access control, security firewalls, web caches, reverse proxies (posing as Web servers, requests sent to Web servers, and Web servers, It can initiate requests with other servers to locate the requested content on demand, the content router, the transcoding device, the anonymous (remove identity information from the message, and provide privacy).
Depending on the purpose of the agent, you can place the agent in any location, such as:
Export agent: Fixed at the local network exit point, control local and external network traffic, prevent malicious hacker attack.
Access (ingress) Proxy: Placed on an ISP access point to process aggregate requests from customers. The ISP uses the cache proxy to store copies of frequently used documents to increase download speed.
Reverse proxy: Deployed at the edge of the network, before the Web server, usually directly run the name and IP address of the Web server, so that all requests will be sent to the agent, he will process all requests, and only if necessary to the Web server to request resources.
Network Switching agent: the agent with sufficient processing power is placed on the Internet peering point between the network, through the cache to alleviate the congestion of the Internet nodes, and to monitor traffic.
So how do you direct traffic to agents? There are four ways to modify the client (modify browser settings), modify the Network (monitor HTTP traffic for switching devices and routing devices, intercept it, then import traffic into the proxy), modify the DNS namespace (such as reverse proxy, edit DNS directly, impersonate the proxy as a Web server), Modify the Web server (configure the server to redirect the accepted requests to the proxy).
Generally see how many proxies a request has passed, and you can learn about it from via header, such as:
via:1.1 proxy-62.irenes-isp.net,1.0cache.joes-hardware.com
Indicates that after two agents, the order of the response message and the request message is exactly the opposite. Via also records the conversion of the Protocol, for example, some proxies provide gateway functionality for servers that are not HTTP protocols, as follows:
VIA:FTP/1.O proxy.irenes-isp.net (traffic-server/5.0.1-17882[cms f])
And the trace method we talked about earlier, it's easy to see how the message changes in the process of forwarding the message over and over the HTTP proxy network.
Cache
Web caching is an HTTP device that can automatically save a copy of a common document, a repository of HTTP, and a copy of a frequently used page that is kept closer to the client. When the Web requests a tick cache, if there is a "cached" copy locally, the document can be extracted from the local storage device instead of the original server. Proxy caches generally have hierarchies, primary cache, level two cache, and so on, most users want to hit the first level of cache, but if not, the larger level two cache will handle the request, in addition to this is relatively simple mesh cache, content routing level peer cache.
The general process of caching is: Accept-Parse-query-freshness detection-Create response-send-log. Because it is a cache, so there will be the case of a copy expires, usually through the HTTP special Cache-control header and Expires header, HTTP let the academician server want each document attached an "expiration date", because Cache-control uses the relative time, So more inclined to use it.
Just because the cached document is out of date does not mean that it is actually different from the document that is currently active on the original server, which means checking the work, which is called "Server re-authentication", to indicate whether the cache needs to be updated. The conditional method can be effectively re-verified, the cache sends a "conditional get" to the server, the request server only if it is inconsistent with the cache to return the existing copy, the most useful two headers for cache re-authentication are if-modified_since and If-none-match.
There are several ways that the server can be defined by HTTP to specify how long it can be cached before the document expires. In descending order of precedence, the server can attach a header to the response: Cache-contorl:no-store; Cache-contorl:no-cache; Cache-contorl:must-revalidate;max-age; Expires, the specific first usage is not explained. Different Web servers provide a number of different mechanisms for Httpcache-control and expiration header settings, with detailed settings available for Baidu.
Http--web server, Proxy, cache