使用者:惟吾無為/icp
互聯網緩存協議(Internet Cache Protocol,ICP)是一種用於協調web緩存的協議。它的目標是高效地利用緩存,就是在同一站點重複使用文件(一般為css,js,背景圖片等共用資源)時既能減少請求次數,又要保證文件及時更新。
緩存是分層的,由父節點和子節點組成。 父母們通常會比孩子坐的互聯網連接。如果一個孩子緩存不能找到一個對象,查詢通常會被發送,這將取父緩存,高速緩存,並通上的要求。兄弟姐妹是高速緩存的等級地位平等,其目的是兄弟姐妹之間的負載分配。 當一個請求進入一個高速緩存集群中的兄弟姐妹,ICP是用來查詢被請求對象的兄弟姐妹。如果同級的對象,它通常會被從那裡轉移,而不是從原來的服務器受到質疑。這通常被稱為一個「有驚無險」的對象在緩存中找到(「小姐」),但它是從附近的一個緩存,而不是從遠程服務器加載。 ICP協議被設計成輕量級的,以儘量減少緩存之間的往返時間。它的目的是不可靠的,但快速的連接。 ICP協議RFC 2186,其應用層次的網絡緩存在RFC 2187中描述。 Web代理支持ICP包括:
Hierarchically, a queried cache can either be a parent or a sibling.
Parents usually sit closer to the internet connection than the child. If a child cache cannot find an object, the query usually will be sent to the parent cache, which will fetch, cache, and pass on the request. Siblings are caches of equal hierarchical status, whose purpose is to distribute the load amongst the siblings.
When a request comes into one cache in a cluster of siblings, ICP is used to query the siblings for the object being requested. If the sibling has the object, it will usually be transferred from there, instead of being queried from the original server. This is often called a "near miss"—the object was not found in the cache (a 「miss」) but it was loaded from a nearby cache, instead of from a remote server.
The ICP protocol was designed to be lightweight in order to minimize round-trip time between caches. It is intended for unreliable but quick connections.
The ICP protocol is described in RFC 2186, its application to hierarchical web caching in RFC 2187.
Web proxies that support ICP include:
- CACHEbox
- Cisco CacheEngine[1]
- Cisco Content Engine
- DeleGate[1]
- Harvest project[1]
- Traffic Server[1]
- Mirror Image[1]
- MOWS[1]
- NetCache[1]
- Netscape Proxy Server[1]
- Novell BorderManager FastCache[1]
- ProxySG
- Squid[1]
- SkyCache[1]
HTCP, designed as a successor to ICP, attempts to handle various problems found in ICP deployments.
ICP message structure
An ICP message consists of two sections:
- Header
- Data
Header: Header length is fixed to 20 octets (five 32-bit words).
Data: Data is of variable length, limited by the maximum ICP message size (including header) of 16,384 octets.
The ICP header consists of 8 fields, with 2 optional fields. The fifth and sixth field is optional (pink background in table) and appropriately named 「options」 and 「option data」.
Bit offset | Bits 0–7 | 8–15 | 16-31 | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Opcode | Version | Message Length | |||||||||||||||||||||||||||||
32 | Request number | |||||||||||||||||||||||||||||||
64 | Options | |||||||||||||||||||||||||||||||
96 | Option Data | |||||||||||||||||||||||||||||||
128 | Sender Host Addresss | |||||||||||||||||||||||||||||||
160+ | Data |