Compression helps to achieve higher throughput rates by decreasing the latency over the network. Smaller the size of an object, lesser would be the time it takes to travel. This improves the performance of in-memory distributed caching solution by making both sending and receiving in-memory cached objects a lot faster.
Moreover, compression and decompression are done on the client side therefore there is no extra load on distributed cache servers in a web farm and throughput is further increased. Please note that compression should only be enabled if your application object size is more than 50 KB.
To enable compression with NCache you need to do the following simple steps:
Step 1Open the NCache Manager and find all the available caches listed on the left pane in a tree structure. Click on the particular cache on which you want to enable compression.
Step 2On the right hand side a TabControl panel will appear that displays all options for configuration settings of the selected cache.
Step 3Open the Options tab and you will find multiple options for configuration settings of this cache.
Step 4Near the bottom of the Option setting you will see Compression Threshold panel. Check the Enable Compression check box. The preferable threshold size is 50 KB but that can be changed as preferred.
Step 5Whenever making any changes to any setting in NCache Manager always remember to save these settings. You can do this by right-clicking on the same cache again in the left pane and then selecting Apply Configurations.
Congratulations! You just enabled Compression with NCache
You can verify that NCache Manager has enabled compression with the selected cache as follows:
Step 1Open the configuration files that are located at the default location like C:/Program Files/NCache/config. This folder contains multiple .ncconf files.
Step 2Open the config.ncconf file in any text editor. Within the <cache-config> tag you will see the <compression> tag. This tag will verify that whether compression has been enabled and threshold has been set to the desired limit like example given below:
<compression enabled="True" threshold="50kb"/>