Squid introduction and proxy

Source: Internet
Author: User
Tags dedicated server squid proxy

1. Squid Introduction

1. Introduction to cache servers

A cache server is a dedicated server used to store webpages, images, files, and other information accessed by users (memory and hard disk). This server not only allows users to get the information they want as quickly as possible, in addition, the data volume transmitted over the network is greatly reduced, and the cache server is often a proxy server. Invisible to users.

Common Cache Server Software: Squid, varnish, and nginx


2. cache hit rate

Cache hit:

1) occurs every time squid satisfies the HTTP request from its cache. Cache hit rate, which is the percentage of hits among all HTTP requests. The typical cache hit rate of Web Cache is between 30% and 60%. Another similar measurement unit is the byte hit rate, which depicts the data capacity (in bytes) provided by the cache ).

Cache loss:

This occurs when squid cannot satisfy HTTP requests from its cache. There are many reasons for cache loss. The most obvious,

1) When squid receives a request for a special resource for the first time, it is a cache loss.

Solution: prefetch

2) in a similar situation, squid clears the cache to release space for new objects.

Solution: the disk size is as large as possible.

3) Another possibility is that resources cannot be reached. The original server instructs the cache on how to handle the response. For example, it prompts that the data cannot be cached or used repeatedly within a limited period of time.

Cache validation:

1) the cache confirms that squid does not return outdated data to the user. When the cached object is reused, squid often confirms it from the original server. If the server indicates that the copy of squid is still valid, the data will be sent out. Otherwise, squid upgrades its cache copy and forwards it to the customer.


3. Squid:

1) reverse proxy

2) Forward proxy (normal proxy)

3) Transparent proxy

4) Web Cache


4. Forward proxy


1) An internal user wants to access the Sina website by setting the specified proxy server in the browser.

2) internal users connect to the proxy server (SQUID server ).

3) squid: Check whether the local cache has resources requested by the user. If yes, it is directly returned to the user.

4) if the local cache does not exist, squid requests Sina, returns the request results to the user, and caches the memory to the cache.

650) This. width = 650; "alt =" Squid overview and proxy-dactylogram "src =" http://img1.ph.126.net/uG5y4_Kwb1oVudaA1nC6Vw==/1055531162681799115.png "style =" border: 0px; Height: auto; margin: 0px 10px 0px 0px; "/>

 

5. Reverse Proxy

In contrast to the forward proxy, external users access internal servers.

650) This. width = 650; "alt =" Squid overview and proxy-dactylogram "src =" http://img0.ph.126.net/Xivj6BtVPOqjyU_IpNmWxg==/6608739983073984516.png "style =" border: 0px; Height: auto; margin: 0px 10px 0px 0px; "/>

 

1) external users want to access the website of our IDC server.

2) an external user first requests an internal Proxy Server (SQUID server ).

3) squid: Check whether the local cache has resources requested by the user. If yes, it is directly returned to external users.

4) if the local cache does not exist, squid requests Sina, returns the request results to the user, and caches the memory to the cache.



6. Transparent proxy

650) This. width = 650; "alt =" Squid overview and proxy-dactylogram "src =" http://img0.ph.126.net/5iCB6HUcp8H11wszWJSPgg==/1174032127877660454.png "style =" border: 0px; Height: auto; margin: 0px 10px 0px 0px; "/>

 

1) The internal user requests to access Sina without setting a proxy in the browser.

2) The user first requests the firewall to access port 80 of Sina.

3) The firewall forwards the 80 internal request to port 3128 of the Squid proxy server.

4) the squid server checks whether the cache contains the content requested by the user. If yes, it sends the content to the user through the firewall.

5) If no, the request is cached in the cache and the request result is sent to the user through the firewall.



This article from the "O & M cainiao" blog, please be sure to keep this source http://ckl893.blog.51cto.com/8827818/1569782

Squid introduction and proxy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.