跳转到内容

User:惟吾无为/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:

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”.

ICP Header
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
 

References


Template:Compu-network-stub