Search code examples
windows-server-2008appfabric-cache

Does AppFabric Cache compression cause data to be stored compressed on the server?


Does Windows Server AppFabric Cache compression cause data to be stored compressed or just transmitted compressed?

Is it intended to just save network bandwidth or both bandwidth and server memory ?

Note this is a Windows Server AppFabric question.


Solution

  • Yes, because data is compressed on the client.

    A really simple way to check this is to CmdLet Get-CacheStatistics.

        DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1];
        servers[0] = new DataCacheServerEndpoint("fr-vmrd-web1", 22233);
        DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
        factoryConfig.Servers = servers;
        factoryConfig.SecurityProperties = new DataCacheSecurity(DataCacheSecurityMode.None, DataCacheProtectionLevel.None);
        factoryConfig.TransportProperties.MaxBufferSize = int.MaxValue;
        factoryConfig.TransportProperties.MaxBufferPoolSize = int.MaxValue;
        factoryConfig.IsCompressionEnabled = true;//or false
        DataCacheFactory mycacheFactory = new DataCacheFactory(factoryConfig);
    
        var data = File.ReadAllText(@"c:\test.log"); //40 MB
        DataCache myDefaultCache = mycacheFactory.GetDefaultCache();
        myDefaultCache.Put("test", data);
    

    With Compression

    ...
    Size              : 2575360
    ItemCount         : 1
    RegionCount       : 1
    ...
    

    Without Compression

    ...
    Size              : 41900032
    ItemCount         : 1
    RegionCount       : 1
    ...
    

    Hope this will help you.