1

I have a web farm which contains 4 web servers hosting a web application(x), which is controlled by a Network load balancer, for distrubuted session maintenance i have used App fabric cache as my session provider.

I use only one cache server with a region created.

My config contains the Region name and shared App ID, which is same across all the web apps(x) hosted across the farm.

However i see if i access the web apps using IPs all the sessions are different

http://10.10.10.1/myapp/file.aspx returns different session values
http://10.10.10.2/myapp/file.aspx returns different session values
http://10.10.10.3/myapp/file.aspx returns different session values
http://10.10.10.4/myapp/file.aspx returns different session values
http://servername/myapp/file.aspx returns different session values

what is the use of sharedId in this scenario ? my itention is to have a single session maintained though my app is hosted in multiple servers for performance.

The main problem is my cache doesnt behave normal, sometimes the session values are not updated even for 1-2 minutes after change

my web.config settings

<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"/>

<dataCacheClient>
    <!-- cache host(s) -->
        <hosts>     
          <host name="x" cachePort="22233" />
        </hosts>
    <securityProperties mode="None" protectionLevel="None" />
</dataCacheClient>


<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
    <providers>
        <add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="xyz" sharedId="app123"  />
  </providers>
</sessionState>

1 Answers1

1

Try to see if you keep always the same ASPNET Cookie (using developper tools in your favorite browser). Because a cookie is also bound to a domain, your browser won't send it if domains are different.

On the cache cluster, check the number of sessions : if you have more than one session, you will certainly have a problem in your distributed session management.

Cybermaxs
  • 24,378
  • 8
  • 83
  • 112