This feature is only available in NCache Enterprise Edition.
NCache provides data compression to limit the data traffic between the cluster and client nodes. Data compression stores data in a compressed form which helps utilize limited available memory more efficiently. By default, data compression is disabled. This can be configured using NCache Manager.
To see how to enable/disable data compression, refer to the Configuring Compression section.
Why to Use Compression
Data compression benefits the user in multiple ways. When data is compressed, it takes lesser space which reduces memory consumption. Compression provides faster performance of the operations since the operations performed on the cache are read/write intensive. The overall network cost is reduced as it takes lesser network trips to transfer data in a network, which eventually reduces time consumption as well.
Changes made to the NCache compression settings will effect the following configurations in the config.ncconf file accordingly.
<compression enabled="true" threshold="500kb"/>
The above mentioned example specifies whether the items with size greater the threshold provided should be compressed/decompressed at client side or not.
enabled: To enable compression, this attribute is set as "True". If this attribute has not been set to True, then compression is disabled. By default, compression is disabled for all caches so
enabled is "False" by default.
threshold: Specifies the threshold value. Only those items that are greater then this value will be compressed/decompressed at client side (or sometimes on server side).
What does Compression do?
NCache applies GZip Compression for all items greater than the specified threshold value once data compression is enabled via NCache manager. This provides more memory storage and minimizes network traffic.
On the objects of the size less than the specified threshold value, NCache does not apply compression. These items travel through the network and are stored in the cache in their original sizes.
Where does Compression Occur?
In most cases, compression/decompression occurs at the client side. But, sometimes, NCache server does the compression/decompression of the data itself.
Client side compression/decompression
Client side compression/decompression occurs if NCache compression is enabled, and if any of the below mentioned cases occurs:
For the items that are being sent to a remote server by the client with size greater than the specified threshold, those items need to be compressed before they are sent to the cache servers. Cache servers just store the data without applying any data compression.
If compressed data is requested by the client, then the cache server does not apply any decompression and sends the data in its compressed form over the Internet. The client receives the compressed form and decompresses the data itself.
Server side compression/decompression
Server side compression/decompression occurs if NCache compression is enabled, and if any of the below mentioned cases occurs:
- For the items that are being loaded through the cache startup loader or read-thru provider and are of size greater than the specified threshold, these items are compressed by the NCache server. NCache server compresses this data after receiving it from the data source and before storing it in the cache.
NCache decompresses the compressed data that has to be written to a data source via configured write-thru or write-behind provider before sending it to the data source.
Compression on Client Cache
Client cache compresses the data on its own. If both the server and client cache have compression enabled, then the server compresses the data according to the server threshold and client cache will compress the data according to its own threshold value. Even if compression is disabled on either of them, data is compressed only for the cache on which it is enabled.
Compression is independent of Cache topologies.
Security and Encryption
Configure Encryption for a Cache