Azure Persisitence

Topics: Installing Orchard
Feb 19, 2013 at 4:58 PM
I'm playing about with Azure and I want to understand how information is stored.

On the guide to deploying Orchard to Azure it says:

'In order to use Orchard in Azure, you need to configure it against the SQL Azure database in order to ensure that application state is retained while Azure recycles instances of your site during load balancing.'

For experimental purposes I ignored this advice and all is working fine so far. I can also stop and start the site and the DB is still available as are new modules and themes I've installed.

I have 4 questions:
  1. What will cause the modules and DB files to be deleted and can I make this happen for testing?
  2. Is Orchard config stored somewhere else in the Azure version which stops it having the same problem as the db file?
  3. Is the Media folder safe to use in Azure?
  4. What would happen if I increased the number of instances?
Feb 19, 2013 at 5:00 PM
How embarrassing. I've spelled 'persistence' wrong and I don't seem to be able to change it.
Feb 21, 2013 at 2:30 AM
If you are using an Azure Web Site, you can ignore around 100% of what's said in that article. Azure Web Sites behave like ordinary hosted ASP.NET. The file system is safe to use. It will be replicated between instances.
Feb 21, 2013 at 11:30 PM
Can Orchard still run in an Azure Cloud Service and is there a good reason to do this?

If it was running in the cloud service what would the answer to the four questions be?
Feb 22, 2013 at 1:33 AM
Yes, Orchard can still run as a Cloud Service.
  1. I have looked for the answer to this too, but didn't find one. The only documentation I can find just says that the local storage is not guaranteed to be durable. It doesn't say when the storage will be wiped out.
  2. Settings.txt tells orchard where the database is. The database has all the durable config data, but the Orchard web role instances cache that data to local storage when Orchard starts.
  3. Yes, but you should use the FileSystem abstraction in Orchard. Look at the existing code that writes to the Media folder for examples. If you use this abstraction, the Cloud Service version of Orchard will use a concrete implementation that writes to blob storage instead of local storage. Blob storage is durable.
  4. You suddenly have a farm. If you followed the advice in my answer to #3, the stuff you wrote to blob storage is accessible to all the instances, and even publicly via http URL's. It's a very nice design, I think.
Feb 24, 2013 at 10:53 AM
It's starting to become clear now.

It seems easier to use Azure Websites because you can install modules and themes in the normal way.

What are the benefits of using Azure Cloud Service?
Feb 24, 2013 at 6:08 PM
Here are the benefits of using could services:
Feb 25, 2013 at 11:00 AM
Bertrand, do you mean there are no benefits?
Feb 25, 2013 at 12:46 PM
Feb 25, 2013 at 6:02 PM
Mar 3, 2013 at 6:56 PM
Although Bertrand's reply made me smile I disagree with his assessment. There are definitely advantages to using Cloud Services over Azure Web Sites.
  1. Web Sites do not support custom SSL certificates yet.
  2. Web Sites lack the staging/production slot capabilities and instantaneous VIP-swapping of Cloud Services. These are handy when doing upgrades, as you can upload a whole new version of your service, test it out, and then VIP-swap in into production with a single fast operation while retaining the same public IP-address of your service, etc.
  3. With Cloud Services you can do more advanced deployment stuff like installing perf counters, registering COM components and manipulating the registry, should you have those requirements.
  4. With Cloud Services you can remote desktop into the underlying VM and do much more advanced troubleshooting and diagnostics.
That being said, Web Sites of course definitely also have a set of advantages over Cloud Services, but that's another thread.
Mar 4, 2013 at 1:15 AM
Ok, ok. Hopefully 1. won't be an advantage for much longer. 2. is definitely sweet although this: "a single fast operation" made me chuckle. Hopefully we see that type of environment swapping on web sites as well soon. As for 4., I didn't know you couldn't TS into a web site, but on the other hand you do have ftp access and lots of flexibility that you will never get from cloud services.
Mar 15, 2013 at 11:48 AM
Edited Mar 15, 2013 at 11:49 AM
Thanks for your help. I wrote a quick guest post about running Orchard on Azure for MSDN blogs. I couldn't have got some of the detail right without the help I got in this thread.

If I've made any mistakes or missed anything out, please leave a comment on the post.
Mar 16, 2013 at 8:36 PM
One more advantage by the way: in Cloud Services you can enable distributed caching in the form of Windows Azure Cache, which by the way also happens to be fully memcached compatible. You can then configure Orchard to use it for both output caching, application caching and nHibernate second-level cache. No equivalent exists for Azure Web Sites.