22

Does anyone have any information on how state is managed in Azure when you choose to have multiple instances? It seems like InProc would be worthless and you would have to have another state server instance, or use the datastore to store the users state across servers.

Or does it implement sticky sessions, so InProc is all you need.

Found the answer here: Azure Forums

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Arron S
  • 5,511
  • 7
  • 50
  • 57
  • This link is dead, does anyone know if this information is elsewhere ? – andynormancx Jan 24 '11 at 17:26
  • See my answer below, with links to the Cache FAQ as well as a link to details on the new ASP.NET Universal Providers (the new Session State provider supports SQL Azure natively). – David Makogon Dec 21 '11 at 04:00

4 Answers4

18

Table Storage would be the most logical place. Other server farm type setups also use a database table to store session info.

Take a look at the AspProviders project in the Windows Azure SDK samples. It has a SessionState provider that uses Azure Table Storage.

CoderDennis
  • 13,642
  • 9
  • 69
  • 105
  • Since you pay per transaction with Table storage, I wonder if SQL Azure would be better from an economical standpoint since you're just paying for bandwidth (in addition to the db itself). – Chad Levy Jun 05 '10 at 20:01
  • 6
    I'm pretty sure Table storage is the more economical choice. 1 GB SQL Azure is $9.99 per month. You can store 1 GB in Table Storage for 15 cents. Transactions are 10,000 for one cent, so with the remaining $9.84, you could get 9.84 million transactions. So, if you're over 10 million transactions per month, then SQL Azure would be cheaper. Data transfer fees are only paid for data in/out of Azure, so session data shouldn't be subject to those costs. – CoderDennis Jun 08 '10 at 20:40
  • But how do you delete old session information from table and blob storage? – joe Jul 08 '10 at 04:24
  • 1
    I'd just be careful with the AspProviders samples in the SDK (they are actually in a separate download and not in the SDK anymore, if I remember correctly). Last I checked (granted, some time ago, so things might have changed), they were quite old and had issues. Plan to do some testing before using them. – Eugenio Pace Mar 19 '11 at 01:36
  • 2
    The AzureProviders samples is no longer included in the Azure SDK. I made a project on http://azureproviders.codeplex.com that includes a session provider, it is in the SCM still and will be included in V1.1. –  Mar 27 '11 at 12:20
  • @EugenioPace unfortunately not much has changed! the code at http://code.msdn.microsoft.com/windowsazure/Windows-Azure-ASPNET-03d5dc14 doesn't work in a whole bunch of scenarios – Matt Warren Oct 05 '11 at 09:34
13

AppFabric Cache just went into production, and this is an excellent way to manage session data. In fact, it has a custom session state provider that simply drops into web.config. You'll find it in the Azure portal.

All info around cache sizes, pricing, and SLA is here.

Edit: Windows Azure Web Role templates now include the new ASP.NET Universal Providers, including a Session State provider that supports SQL Azure. Take a look at Nate Totten's blog post for more details.

EDIT 7/8/2012 Windows Azure now provides both a Cache Role and in-memory cache (both easily configurable with the latest tools and v1.7 SDK). The in-memory cache spreads cache across one of your existing roles instances, utilizing a set percentage of RAM (nice "free" option if you don't need much RAM in your app).

David Makogon
  • 69,407
  • 21
  • 141
  • 189
2

Not requiring session affinity and thus using session state providers that rely on Azure storage or SQL Azure storage is the best choice.

For some legacy applications you may still need session affinity. For those cases, ARR between Azure load balancer and the Web farm is an option.

More details at http://go.archims.fr/hW54Xz

bipen
  • 36,319
  • 9
  • 49
  • 62
1

Another option would be to use sticky http sessions:

http://dunnry.com/blog/2010/10/14/StickyHTTPSessionRoutingInWindowsAzure.aspx

Then you could use InProc.

Tom
  • 1,611
  • 10
  • 11