On multiengine servers, more than one task can attempt to access the cache.
By default, each cache has a single spinlock, so that only one task can change or access the cache at a time. If cache spinlock contention is more than 10 percent, increasing the number of cache partitions for a cache may reduce spinlock contention, which improves performance.
All data caches – use the global cache partition number configuration parameter
An individual cache – use sp_cacheconfig
The number of partitions in a cache is always a power of 2 between 1 and 64. No pool in any cache partition can be smaller than 512K. In most cases, since caches can be sized to meet requirements for storing individual objects, you should use the local setting for the particular cache where spinlock contention is an issue.
See Performance and Tuning Series: Basics > Reducing spinlock contention with cache partitions.
Use sp_configure to set the number of cache partitions for all caches on a server.
sp_configure "global cache partition number",2
You must restart the server for the change to take effect.
Use sp_cacheconfig or the configuration file to set the number of local cache partitions.
sp_cacheconfig "default data cache", "cache_partition=4"
You must restart the server for the change to take effect.
The local cache partition setting always takes precedence over the global cache partition value.
sp_configure "global cache partition number", 4
sp_cacheconfig "pubs_cache", "cache_partition=2"
The local cache partition number takes precedence over the global cache partition number, so pubs_cache uses 2 partitions. All other configured caches have 4 partitions.
sp_cacheconfig "pubs_cache", "cache_partition=default"
sp_configure "global cache partition number", 0, "default"