Question

We don't want to use the caching cluster for this because as of now, we're facing some stability issues on the cache clusters so they're on constant maintenance (completely our fault). Could we use a dedicated cluster for session storage? (forget cluster, atleast one host? )

It'll be like using two clusters in the same application, one for caching and one for session storage, and these would lie in the same config file.

Is my approach right? Any help would be appreciated. Thanks!

Thanks to @CyberMax, i was able to set this env up. But, Im getting an error when i run the page :

The configuration section 'dataCacheClients' cannot be read because it is missing a section declaration

500 internal server error

Here's my config :

<configuration>
  <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>

  <system.web>
<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add assembly="Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  </assemblies>
</compilation>
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
  <providers>
    <!--specify the named cache for session data-->
    <add name="AppFabricCacheSessionStoreProvider"  type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="sample-cache" dataCacheClientName="VirtualCache"/>
  </providers>
</sessionState>

 </system.web>


 <dataCacheClients>
   <dataCacheClient name="serverCache">
     <localCache isEnabled="false" sync="NotificationBased" objectCount="100000"/>
     <clientNotification pollInterval="5"/>
     <!--cache host(s)-->
     <hosts>
       <host name="!@13452662.gf.com" cachePort="22233"/>
       <host name="!@13452663.gf.com" cachePort="22233"/>
     </hosts>
     <securityProperties mode="None" protectionLevel="None" />
     <transportProperties maxBufferPoolSize="2147483647" maxBufferSize="2147483647" channelInitializationTimeout="60000" receiveTimeout="900000"/>
    </dataCacheClient>

   <dataCacheClient name="VirtualCache">
     <localCache isEnabled="false" sync="NotificationBased" objectCount="100000"/>
     <clientNotification pollInterval="5"/>
    <hosts>
       <host name="localhost" cachePort="22233"/>
       <host name="localhost" cachePort="22234"/>
       <host name="localhost" cachePort="22235"/>
       <host name="localhost" cachePort="22236"/>
    </hosts>
   </dataCacheClient>
</dataCacheClients>
</configuration>

EDIT :

Changing dataCacheClient to dataCacheClients results in this error:

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

 Parser Error Message: Web configuration error. Check your Web.config file, or revert to     the last working version.dataCacheClientName

Source Error: 



Line 31:       <providers>
Line 32:         <!--specify the named cache for session data-->
Line 33:         <add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="sample-cache" dataCacheClientName="VirtualCache"/>
Line 34:       </providers>
Line 35:     </sessionState>
Was it helpful?

Solution

Yes, you can.

When you configure the AppFabric Sesison State Provider, you can provide a dataCacheClient name. It's the name of the dataCacheClient section to use from the dataCacheClients configuration section. By default, the provider will use the dataCacheClient section named “default”.

, such as

<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider" compressionEnabled="false">
      <providers>
        <add name="AppFabricCacheSessionStoreProvider"
             type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
             cacheName="default"
             useBlobMode="true"
             dataCacheClientName="dataCacheClient1"/>
      </providers>
    </sessionState>

You can have multiple dataCacheClient in your configuraiton file.

 <dataCacheClients>
    <dataCacheClient name="dataCacheClient1">
      <hosts>
        <host name="CacheServer1" cachePort="22233" />
      </hosts>
    </dataCacheClient>
    <dataCacheClient name="dataCacheClient2">
      <hosts>
        <host name="CacheServer1" cachePort="22233" />
      </hosts>
    </dataCacheClient>
  </dataCacheClients>

So, there are no problems to have multiple cache cluster.

Edit :

Here the configuration for AppFabric 1.0

<?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>

  <!-- cache client -->
  <dataCacheClient>    
    <!-- cache host(s) -->
    <hosts>
      <host
         name="CacheServer1"
         cachePort="22233"/>
    </hosts>
  </dataCacheClient>

  <system.web>
    <sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
      <providers>
        <!-- specify the named cache for session data -->
        <add 
          name="AppFabricCacheSessionStoreProvider" 
          type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" 
          cacheName="NamedCache1"
          sharedId="SharedApp"/>
      </providers>
    </sessionState>
  </system.web>
</configuration>

Here the configuration for AppFabric 1.1

<?xml version="1.0"?>

<configuration>
  <configSections>
    <section name="dataCacheClients"
             type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core"
             allowLocation="true" allowDefinition="Everywhere"/>
  </configSections>

  <dataCacheClients>
    <dataCacheClient name="default" channelOpenTimeout="10000">
      <hosts>
        <host name="CacheServer1" cachePort="22233" />
      </hosts>
    </dataCacheClient>
  </dataCacheClients>

  <system.web>
    <sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider" compressionEnabled="false">
      <providers>
        <add name="AppFabricCacheSessionStoreProvider"
             type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
             cacheName="default"
             useBlobMode="true"
             dataCacheClientName="default"/>
      </providers>
    </sessionState>
  </system.web>
</configuration>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top