WCCP provides packet distribution through two algorithms, Hash and Mask. This FAQ is designed to provide a high level look at these algorithms and the roles the Cache Engines and Routers play in their execution.
FLOW:
By way of definition, a “flow” in this document refers to the unique source ip, source port, destination ip and destination port of a UDP or TCP frame constructed for the transport of application data, such as HTTP, FTP, RTSP etc.
DESIGNATED CACHE:
When a WCCP service group is formed, the ProxySG with the lowest IP address automatically becomes the designated cache . The designated cache is responsible for communicating to the router(s) within the service group the parameters for the calculations of packet distribution (source ip, destination ip, source port, destination port) as well as the slot assignments within the distribution matrix (256 Buckets/Masks) used by the routers in calculating where to send a flow.
DISTRIBUTION ALGORITHM: (HASH OR MASK):
This refers to the type of algorithm used by the routers to calculate the destination of a flow.
Both algorithms are based on two parameters:
· first parameter = {source | destination}
· second parameter = {ip | port}
The Designated Cache is responsible for communicating to the routers, which of these parameters (source ip, destination ip, source port, destination port) to use in execution.
The parameters to communicate to the router(s) are configurable via the wccp settings in either the GUI or via the command line on the ProxySG.
HASH:
With hash assignment, the router runs a value in the header of the packet it is redirecting through a hashing function.
The Hashing function uses as input the designated destination or source ip, or the destination or source port. The hashing function involves performing an “exclusive or” (XOR) operation on these values. The result must fall into one of the 256 buckets each of which is assigned to a ProxySG in the service group.
Hash assignment can be CPU intensive at the router, but it is the only option if you are using a software-based router.
By default, each ProxySG in the service group is assigned roughly an even percentage of the 256-bucket hash table. However, you can override this behavior by configuring a weight value to adjust the proportion of the hash table that gets assigned to the ProxySG.
MASK:
With mask assignment, each router/switch in the service group has a table of masks and values that it uses to distribute traffic across the ProxySG appliances in the service group. When the router/switch receives a packet, it performs a bitwise "and" operation between the mask value and the fields of the packet header that are designated in the ProxySG mask assignment configuration. It then compares the result against its list of values for each mask; each value is assigned to a specific bucket, which corresponds to a ProxySG in the service group.
By default, each ProxySG in the service group is assigned roughly an even percentage of the mask values. However, you can override this behavior by configuring a weight value to adjust the proportion of the mask values that gets assigned to the ProxySG.
ALTERNATE HASH:
There are two methods used by the Cisco routers to deterministically direct content to members of a service group. There is a primary hashing scheme and an alternate hashing scheme.
Because the hashing function is based on a packet header field, it is possible that a disproportionate amount of traffic will be redirected to the same ProxySG. For example if the hashing function is based on destination IP address and many users are sending requests to the same destination, a disproportionate number of packets will get redirected to the same ProxySG
If the hash algorithm results are not spread out across the buckets, but are concentrated into just a few buckets, the cache machine should announce a hotspot. When a hot spot occurs, the router(s) switch to the alternate hash/mask scheme.
The alternate scheme as well as the hotspot parameters are defined at the ProxySGs in the WCCP settings and communicated by the designated cache to the router(s). Obviously, it should be different than the primary scheme to obtain different results.
WEIGHT:
By default, each ProxySG in the service group is assigned roughly an even percentage of the 256-bucket hash table or of the 256 mask values. However, you can override this behavior by configuring a weight value to adjust the proportion of the hash table that gets assigned to the ProxySG.
Many times wieght adjustments are used in environments where there are varying degrees of processing capability amongst the caches in the pool. By adjusting the weight, the more powerful caches are given more buckets/masks which should translate to more flows to process.