2 Sharing the Cache

Often, it is very desirable to share the component cache across application servers for performance, managability and synchronicity issues.

The location of the component cache is a separate configuration variable (the componentCacheRoot configuration variable). The component cache can be segmented easily among multiple fileservers and the SkunkWeb will now fail over to a local cache if the file server goes away unexpectedly.

The component cache segmentation is done as follows. If the numServers configuration variable is set to something other than zero, a number of options are now effective. At the top of the component cache root (CCR), there will be N directories, where N is the number of servers, numbered 0..N-1. You can either mount your remote volumes there or have symbolic links to where they are actually mounted, or any number of similar options.

When SkunkWeb goes to operate on a cached form of component output, it takes the last 16 bits of the MD5 hash that it computed, mods it by the number of file servers and operates on the cache entry under the directory numbered by the result of the mod operation. If an operation fails when operating on the component cache (other than the usual errors of files existing already or files not existing), SkunkWeb will fail over that servers portion of the component cache to the (presumably) local failover cache (specified by the failoverComponentCacheRoot configuration variable) for failoverRetry seconds. After failoverRetry seconds, it will again attempt to go back to using that servers' directory under the CCR.

NOTE:The failoverComponentCacheRoot and failoverRetry options are ineffective if numServers is zero.

To make this work over NFS, the filesystems must be soft mounted!