DataCacheException:ErrorCode:SubStatus is being thrown when using Windows Azure Cache
Problem
Application using Windows Azure Cache has encountered "DataCacheException:ErrorCode<ERRCA0016>:SubStatus<ES0001>"
Symptoms
- Application is using Windows Azure Cache
- Intermittently or while storing larger objects, One of the below errors are encountered
[DataCacheException:ErrorCode<ERRCA0016>:SubStatus<ES0001>:The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server. Result of the request is unknown.]
[DataCacheException:ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.)]
Cause
Size of the object application is trying to store in Windows Azure Cache is more than 8 MB. As of now, Windows Azure Cache supports objects only up to 8 MB and size is measured post the serialization.
Resolution
Before storing the objects in Windows Azure Cache, serialize the object and find out the size of it and if the size is above 8 MB, split the object into smaller chunks, may be byte arrays, etc and then store the byte arrays in Cache.
References
API Reference for Windows Azure Caching
https://msdn.microsoft.com/en-us/library/windowsazure/gg278350.aspx
Capacity Planning for caching in Windows Azure
https://msdn.microsoft.com/en-us/library/windowsazure/hh689719(v=VS.103).aspx
Maximizing Scalability,Availability, and Performance
https://msdn.microsoft.com/en-us/library/hh868048.aspx