Search code examples
asp.netappfabricconnectionthrottling

Appfabric cache maxconnectionstoserver


I have a query about network connection throttling when using AppFabric cache.

In terms of an ASP.NET WCF based application, how does the Windows AppFabricCache 'maxConnectionsToServer' setting interact with the System.Net 'maxconnection' setting?

eg. If, as shown below, the maxConnectionsToServer is set to 100 but the maxconnection is set to 50, does maxconnection get 'overrriden' and become 100? Or does the value in maxconnection limit that of maxConnectionsToServer?

...

<dataCacheClient requestTimeout="2000" channelOpenTimeout="0" maxConnectionsToServer="100">
  <hosts>
    <host name="127.0.0.1" cachePort="22233" />
  </hosts>
  <localCache isEnabled="true" sync="TimeoutBased" objectCount="10000" ttlValue="21600" />
</dataCacheClient>

...

<configuration> 
  <system.net> 
    <connectionManagement> 
      <add address="*" maxconnection="50"/> 
    </connectionManagement> 
  </system.net> 
</configuration>

...

Thanks in advance


Solution

  • system.net/connectionManagement has no effect on net.tcp connections, which is what AppFabric is using, only HTTP connections managed by the ServicePoint infrastructure. So you don't have to worry about that, just what you specify for maxConnectionsToServer. I probably wouldn't set this higher than core count unless you're seeing contention.

    For future reference I should also point out that if you're using ASP.NET and have not changed the default processModel/@autoConfig attribute that ASP.NET is actually going to override any attempt to set the "*" maxconnections via .config file to 12 * Environment.ProcessorCount. If you can't change processModel/@autoConfig in machine.config or using CLRConfigFile for the app pool in IIS7.5 then you must re-override this value programattically by setting ServicePointManager.DefaultEndpointConnectionLimit during app startu (e.g. Application_Start).