As a Kentico MVP and Microsoft VTSP for Azure I get a lot of questions from people on different aspects of the platform and how Kentico runs best in the cloud. Every project is different and the way an application uses Azure will depend on how it’s configured and functions. The great part about Azure is the ability to use the pieces you need to deliver the best experience possible. It’s the configurability that really makes it great!
Here’s a couple questions I received recently on Kentico and Azure. I thought it would help a lot of people by putting together a blog of my responses to spread the knowledge. Enjoy…
"What is the difference between a cloud service and a web site? We have published a site as a cloud service and it functions as it should, but we aren’t sure if this is correct?"
In Windows Azure there are several ways to deploy an application. In the initial offering, Microsoft gave the ability to deploy a “Web Role” which is basically a single web application deployed on a server. The application is packaged up and copied up to Windows Azure. Windows Azure retains that application (like a snapshot) within Windows Azure storage. Azure then creates a new virtual machine (web role) within the platform. After creation, it takes the packaged application and deploys it on the server. Any update to the site involves repackaging and redeploying to Azure so that the “snapshot” is updated. At any point Microsoft may “cycle” the web role and tear it down, then stand up a new one. At that point it will pull the “snapshot” and stand back up the application. This solution offers that ability to completely customize the IIS application and the server configuration.
Recently, Microsoft introduced the concept of “Windows Azure Web Sites”. These differ from the “web role” in that it is not deployed to a virtual machine on demand like that. The application itself is deployed on a pre-existing server (either a “shared” (one with many clients) or a “private” server (allocated to only the company)). This solution is more like a traditional hosting company in which you can connect and copy up updated files at any point to the site. Azure keeps these files and the site is instantly updated. The IIS only has a few configuration options.
Kentico will run as a Windows Azure Web Site, however, will not be able to leverage many of the features added to the platform. Kentico utilizes native code to interact with Windows Azure Storage and the CDN. This functionality is currently only included in the “Windows Azure Project” project type for Kentico. Running a Kentico site in Windows Azure Web Sites will operate fine and may be a suitable solution for smaller, simple sites. Any site that needs to utilize multiple Azure systems (CDN, Storage, Messaging, etc..) would need to be a “Cloud Service”.
Also worth noting is that Windows Azure Web Sites are still in “Preview” mode. You may want to look at your options before using this as a production platform.
For now, deploying to a “Cloud Service” is the correct method for Windows Azure.
"Where is the best place to store files (media libraries), database/blob storage etc.?"
A Windows Azure Cloud Service does not offer persistent storage for files. Because of the way it works and the tear down / restore aspects of the servers, every time the server is created it always pulls the application from the package. Unless the package is changed, the application will revert back to the package version. To get around the issue, Kentico utilizes a separate worker role to read/write files to Windows Azure Storage. It would be possible to use SQL Azure to store these files, however, SQL Azure storage is a premium (with a max size of 150 GB). Windows Azure Storage has a limit of a 150 TB, and it’s pennies for a GB. It’s a much more efficient to use Windows Azure Storage for this use. Additionally, using Windows Azure Storage for the media library files enables the use of the CDN for delivery.
The separate worker role in Kentico is because only 1 application / system can read / write to a storage file at any time. In an Azure deployment, Kentico queues these reads/writes on each web server (web role) and they are processed by the single worker role.
"Are there any restrictions from a coding point of view (especially bespoke web parts etc.) that we should be aware of?"
Windows Azure applications have no coding restrictions. You do need to be aware of the aspects of the platform (how storage is stored / accessed, etc.) to make sure your code will function properly. Additionally, Azure offers more features not normally available that can be leveraged. (CDN, Table storage, etc..) From a .NET point of you, it’s still C#/VB.NET and any developer should be able to do it fine. Just be aware that any new web part means a deployment of the new package and cycling of the site.
There are no restrictions from a Kentico standpoint either. Any custom code should work, assuming it will compile. :) You do need to modify your development pattern to fit within the deployment process when moving to Azure. Any updated web part will require a full redeployment of the site.
Kentico uses app_fabric for its sessions. If we wanted to store our own info in a session variable, is there a recommended way of doing this?
Kentico uses the App Fabric for session to handle the web farm aspects of Windows Azure. Using this custom session provider allows session to be abstracted from the server itself and stored in a central location (App Fabric Cache) and accessed by all servers. Once configured, you can store any value you want in session. You will need to make sure your Cache size is large enough to accommodate your values (if they are huge). If you are referring to a different custom provider, you can certainly develop one, as well. Just be sure your solution works in a web farm environment and all servers can access it.
TIP
Kentico's Windows Azure Guide gives some great tips on developing and deploying updated code to Azure. You can find the guide
here.
"How do we set up multiple web-sites and how do we set up multiple geographical instances pointing to a single web site."
This will depend on how you want to manage the sites. You could create a single instance and host all applications in side of there. That would be the simplest solution. By default (and design) an Azure Cloud Service is designed to host a single application. It is possible to deploy multiple “applications” to a single web role. This is referred to a “multi-tenant” deployment. Each application could have its own connection strings for separate databases, etc. The only downside is that all applications would have to be built and deployed together when updating any part of the application.
For multi-locations, the best solution is really to point all of them to a single SQL Azure database. This will potentially introduce a performance hit for the latency of a Asia app hitting a US database. It is possible to use “Windows Azure Data Sync” to replicate the data, but this is still an evolving solution and I’m not sure it’s a viable solution for a Kentico site. There are some other solutions involving Azure Traffic manager to route traffic to certain locations, however, keeping the DBs in sync would be the tough part.
TIP
Learn more about multi tenant deployments
here.
"Is there a way to automate SQL Azure database backups, so for instance take daily database backups. Have you got anything in place to backup site data / databases on your environment?"
Unfortunately, there is no good solution for this. SQL Azure is a redundant, SQL cluster on the backend. Microsoft is copying it behind the scenes to multiple locations, but those backups are for them to adhere to the SLA. Clients have no access to those backups. If a database has bad data, they bad data will simply be replicated to the data centers. This provides a great (and cost-effective) platform for hosting a database. One thing Microsoft doesn’t have a great offering for is automatic backups of this data. It is possible to “export” snapshots of the database at any point. This can be done through the admin site, as well as using the API (REST services). There are a number of companies (Red Gate, Cerebrata, etc.) that have built some 3rd party apps to do this and help companies manage it, but that’s about it. I recommend you check those out to see if any of those meet your needs.
I do expect Microsoft will develop some configurable, reliable way to pull backups on a regular basis. Enterprise-level clients will demand it and I’m sure many have not adopted it yet because of the lack of the feature.
A lot of this information is pretty in depth and will take your team a while to grasp and get comfortable with. I am a Microsoft VTSP for Windows Azure with over 2 years of experience and there are still things I am learning. I highly recommend you educate your staff on Azure by attending a dev camp or other training event. You really need to understand the underlying components to fully know how a Kentico site is deployed and utilizes the platform.
I'll make this type of blog a regular thing as I get new questions. Keep them coming!