Is it possible to adjust AppFabric Cache server to

2019-04-07 05:57发布

问题:

I'm getting an error with the AppFabric Cache Server when I presume a larger object graph gets added to the cache.

ErrorCode :SubStatus: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.

I know for sure its not a network problem. I was able to add a bunch of objects to cache before this particular one. And looking into it, the object is a bit bigger than the others that got added to cache.

How can I adjust the MaxBufferSize on AppFabric Cache?

回答1:

Client Side it is the maxBufferSize on the transport element in your DataCacheClient config section.

   <transportProperties  ..whatever else you have..  maxBufferSize="8388608"  />

Edit:

Example of the DataCacheClient section from MSDN

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!--configSections must be the FIRST element -->
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient"
     type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
        Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, 
        Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      allowLocation="true"
      allowDefinition="Everywhere"/>
</configSections>

<dataCacheClient requestTimeout="15000" channelOpenTimeout="3000" maxConnectionsToServer="1">
  <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
  <clientNotification pollInterval="300" maxQueueLength="10000"/>
  <hosts>
     <host name="CacheServer1" cachePort="22233"/>
     <host name="CacheServer2" cachePort="22233"/>
  </hosts>
  <securityProperties mode="Transport" protectionLevel="EncryptAndSign" />
  <transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456" 
                       maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000" 
                       receiveTimeout="600000"/>
  </dataCacheClient>
 </configuration>


回答2:

You need to increase the buffer size on the server side as well:

If you use XML config add the following:

<advancedProperties>      
    <transportProperties maxBufferSize="8388608" />
</advancedProperties> 

If you use SQL configuration,you need to export it to a file:

Export-CacheClusterConfig -File [yourfilepath] 

Change the file as listed above and than import it again:

Stop-CacheCluster 
Import-CacheClusterConfig -File [yourfilepath]
Start-CacheCluster

Nevertheless it's not recommended to store large files in the AppFabric Cache.