0

If one is using azure cache for asp.net mvc session state management, do deployments including dlls/web.configs changes still boot users/force a new session?

I would assume that since the session is then external to the app that it would keep it open, and not force the user to login again. True?

Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201
Micah
  • 10,295
  • 13
  • 66
  • 95
  • Which cache are you talking about? The shared cache, or the caching "preview" that uses memory on your role instances? – Brian Reischl Nov 07 '12 at 17:24
  • Both? Either? I'd be happy with any knowledge about either to help me make my decision on whether or not to use it. – Micah Nov 07 '12 at 18:09
  • If you're using preview caching, then each Azure deployment will have its own memory pool. So that will definitely clear your sessions. I would guess that the shared caching will not clear your sessions. The data will definitely still be there, so you would only lose the sessions if the session provider did something to check DLL versions. – Brian Reischl Nov 07 '12 at 18:15

1 Answers1

1

You should look at the new caching features in the Azure 1.8 SDK (released last week): http://msdn.microsoft.com/en-us/library/windowsazure/hh914161.aspx

Caching for roles is no longer in "preview" BTW. If you set up a cache cluster and your session state is in that Cache Cluster, then your web roles can go down and your application will continue to work normally.

You can also use the Azure AppFabric caching (which is caching as a service) they provide assemblies for an AzureCachingSessionStateProvider: http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_buildingappswithcacheservice_topic3.aspx

To answer your question: Does distributed session state work if I take down one web role to deploy code?...yes. http://robbincremers.me/2012/02/23/using-windows-azure-caching-service-to-improve-performance-for-your-cloud-services/

I posted a link with how it works with a load balancer. Since the load balancer is stateless it can route any request to any web role/server...since the session state is in a distributed cache, then any web role can successfully respond to the request. If you have 3 web roles and you take 1 or 2 down to update code, the remaining ones can still return requests.

Bart Czernicki
  • 3,663
  • 1
  • 21
  • 19
  • If i post code while someone has an open session, does the deploy cancel out their session? Do they need to login again? Thats the real question. – Micah Nov 07 '12 at 18:51
  • I edited my response...the quick answer is yes and/or it should. – Bart Czernicki Nov 07 '12 at 19:12
  • Thanks! I'm surprised how expensive it is... crazy – Micah Nov 07 '12 at 19:34
  • It is pretty expensive, but session state should be relatively small amounts of data. Even if you have 100,000 active users on an enterprise system you have about 5% logged in at a given moment...and if u have that many users, u should be able to pay for it :) – Bart Czernicki Nov 07 '12 at 21:47
  • If you ever deployed a new set of web roles (deploy to Staging deployment, do a VIP swap) wouldn't that clear your session state? – Brian Reischl Nov 13 '12 at 03:42
  • The session ID is browser based...if you have a (stateless) load balancer passing that sessionID around to 3 different web servers that web server looks up if that sessionID is valid in the distributed cache. If you took down 1 or 2 web servers and still had the distributed cache up, it would still work. If the other servers came back online they now can take requests. I don;t know who would do a live update on their servers/assume everything would work perfect though...if u change what u are serializing in session state that would break immediately. – Bart Czernicki Nov 13 '12 at 20:51
  • @BartCzernicki - I was under the impression that Azure Cache (Preview) is hosted on its own under a shared model that could be persisted between deployments, as per this answer: http://stackoverflow.com/a/20966206/899530 is this not the case? – SB2055 Jan 08 '14 at 05:16
  • @SB2055 yes that is correct, this answer is from 2012 before the new cache preview had been released. – Bart Czernicki Jan 13 '14 at 21:13