How Microsoft Is Taking Over The Cloud

Microsoft Azure is accelerating past every other cloud infrastructure provider. Amazon, Apple, Google, Rackspace, and all the others are being left in the dust.

If you want virtual machines Amazon is the big dog. And there’s a lot of major players here, not just Microsoft, Apple & Rackspace but all the usual suspects including AT&T and IBM. And this is irrelevant. While virtual machines will continue to see a lot of use, they are an obsolete technology surpassed by PAAS and SAAS. They’re also a commodity that you can easily move from one vendor to another, a recipe to a race to minimal profits.

image_thumb_01108FBD[1]

Why Azure is the only game in town

Our experience developing Enforced Vacation (EV) opened our eyes to this new world. We figured at first we would use a hosted VM and throw SQL Server and IIS on it. That’s what we had done in the past for hosted apps and it does work. But we had selected Azure (because Microsoft has been very transparent when they hit issues). And we found all these other services in Azure.

Ok, so looking at what is offered we figured instead of a VM we would use a SQL Database and a website. That way we could scale each by changing settings and did not need to administer a VM, Windows, SQL Server, & IIS. Straightforward shift, but with this we had moved from purchasing VMs to purchasing services. This is a substantial shift and one that once you have done it, you’re hooked. The ease of scaling the database and web service up/out, while not having to screw around with keeping them up to date and running is a gigantic shift.

 And there’s more

As we started diving in to using this we asked Microsoft support questions. Lots and lots of questions. Starting with basic ones and from those diving in further. (I don’t care how stupid I sound from asking questions, I want to fully understand how best to do something.) And from this we learned – a lot.

We need to update the database based on activity. We can do that on each call to our service, but that slows down the response time. We’d always used a worker thread in our IIS app but that is problematic when you have multiple instances that can be spun up, because what can be spun up can also be spun down and that’s a problem. So Azure has worker roles. This are essentially worker threads, but each runs in its own VM and has a controlled shut down process.

You need to communicate with the worker threads, and for that they have queues that persist their data and can be written to and read from by multiple services. So each web service writes its update data to the queue. This is very fast and so has no impact on our service. Each worker role can read from the queue and so one of the roles reads the message and writes that data to the SQL Database.

This is a small example of the beauty of the set of services Azure offers. By using two simple specific services we could simply and safely update our database in a way that did not slow down our response to users querying EV. And Azure has this architected in a way that is infinitely scalable. Larger queues, more requests, just spin up more worker roles.

And even more

As we progressed we discovered more services that help, some we’re using now and some we’ll use if EV is successful enough that we have to scale out. Cloud services is a raw network server, that you can write for using ASP.NET. We use it for our IMAP network services. Traffic Manager will send requests to the closest server we have running. Redis provides caching of objects across all of our services. Web jobs is great for the nightly billing processing. And the list goes on (DocumentDB is solely for storing JSON documents – talk about specific functionality.)

What makes this all work so well is each service in Azure is designed to perform a specific type of task. By designing each to perform just one task, Microsoft has been able to design each to be simple to understand and use. As you understand each service you need, how to use it becomes natural. And that makes it easy to split out how you architect your app.

Equally important, architecting a cloud app correctly requires that you embrace delay and failure, not fight it. A query against a database might take a minute (the VM its on is rebooting due to a service pack). A data center might be down and services there are unavailable. Your app might be so popular requests to it have to be throttled (please, please let that be the case with EV). You might have 100,000 web services all running at 100%.

All of Azure is architected around this. It gives you the tools which not only helps you handle the problems you get in the cloud, it forces you to embrace architecting your application to work well in the cloud. This is why Microsoft is coming to own the cloud. It not only gives you an incredibly well designed toolbox of services to create a well architected cloud app, it guides you into creating an app that works well in the cloud.

Microsoft owns the future

Once a developer understands what they can do with Azure, and why that is so valuable to them, Microsoft has them. I can’t imagine going back to using a VM. I can’t imaging going back to using just a web service and database. As Microsoft grows the number of Azure services from 15 to 50 to 500, how will the other out there ever catch up. They could, Amazon, Apple, & Google in particular have very talented people. But I don’t think they’re even aware that the future, even the now, is no longer VMs and web servers.

Microsoft also has another giant advantage – they “get” developers. Better than any other large company. Far far better. The support from Microsoft as we’ve learned Azure has been superlative (especially the SQL Database group). They need to educate developers on how to best use Azure to pull more in, and they’re doing it really well.

Microsoft may be losing in social, search, & mobile, but they’re well on their way to owning the cloud server stack.

Don’t Count Microsoft Out (yet)

They have a secret weapon, one they’ve had forever, but that their competitors don’t see.

Microsoft “gets” developers. They provide superlative support to developers. This may seem like a simple unimportant thing. It’s not. This is why developers who have used Microsoft solutions always gravitate to them. And this is a million individuals, every time a development group is discussing what technology to use, has these million people lobbying within their group to use the Microsoft tools.

At Windward (my company) we know both Java and .NET really well. And every time we’ve written a server app, we’ve gone with .NET. Part of it is the .NET stack is better designed which can only happen if you have one company architecting the entire thing (the Java stack is a collection of products from different companies and open source efforts). But even more important is the support.

First off, the MSDN forums have Microsoft employees who’s entire job is to answer questions on the forums. No matter how esoteric the question, in most forums (theIE F12 forum being a rare exception) you’ll get an answer. They will even go to the development teams to find the answer if needed.

And if that isn’t sufficient, you can open a support ticket on any question. With a MSDN subscription you get some of these thrown in for free. But even if you have to pay, it’s well worth it to get a quick answer to any question.

For a development team, with deadlines always hanging over your head, knowing you can get any question answered about the software you use is gigantic. No one wants to face the possibility of a multi-week delay as you try to figure out what is going on in a software library you can’t get support for.

Microsoft Support Plans

The Stack Overflow Effect

A lot of other companies have embraced StackOverflow for technical questions. Google & Oracle have apparently outsourced all their support there. I’m guessing someone in accounting came up with the brilliant idea of “hey, let’s send people there and others will answer for free – eliminating the cost.” Except, no. Yes if you ask an easy question, someone will answer it. But for the harder questions Stack Overflow tends to be ask-only.

This has led to the situation where Microsoft’s competitors all figure they are providing quality support (via Stack Overflow). Meanwhile developers see that using products from these other companies could lead to significant unexpected delays as they are left trying to figure out how a library works.
Meanwhile, while Microsoft products have their equal share of undocumented results, bugs, unclear documentation, etc. – they also provide a fast workaround. And it’s a workaround that can be depended on.

As Microsoft continues to keep the faith of most developers out there that Microsoft has their back, those developers will continue to select Microsoft solutions whenever possible. And that is a giant advantage for Microsoft.

Table Value Parameters in an Update

Table Value Parameters are really powerful, but there’s almost no documentation (here’s the best I found, and this helps a bit) on how to use them in an Update. So here we go:

First create a type in the database (not a table). You do this as follows:

CREATE TYPE ParamsUserStats AS TABLE 

( UserId INT,

  BandwidthThisMonth BIGINT,

  MailsHeldThisMonth BIGINT,

  MostRecentEmail SMALLDATETIME

);

Then you code it up as follows:

protected virtual void _UpdateStatus(IDbConnection conn, IEnumerable<UserStatus> userStatus)

{

 

    // put the params in a table

    DataTable table = new DataTable();

    table.Columns.Add("UserId", typeof(int));

    table.Columns.Add("BandwidthThisMonth", typeof(long));

    table.Columns.Add("MailsHeldThisMonth", typeof (long));

    table.Columns.Add("MostRecentEmail", typeof (DateTime));

    foreach (UserStatus statOn in userStatus)

        table.Rows.Add(statOn.UserId, statOn.AdditionalBandwidth, statOn.AdditionalMailsHeld, statOn.MostRecentEmail);

 

    using (IDbCommand cmd = conn.CreateCommand())

    {

        cmd.CommandText = "update [User] set " +

                          "[User].BandwidthThisMonth = [User].BandwidthThisMonth + stats.BandwidthThisMonth, " +

                          "[User].MailsHeldThisMonth = [User].MailsHeldThisMonth + stats.MailsHeldThisMonth, " +

                          "[User].MostRecentEmail = stats.MostRecentEmail " +

                          "from [User] inner join @TableStats as stats on [User].UserId = stats.UserId";

 

        cmd.Parameters.Add(

            new SqlParameter()

            {

                ParameterName = "@TableStats",

                SqlDbType = SqlDbType.Structured,

                TypeName = "ParamsUserStats",

                Value = table,

            });

 

        cmd.ExecuteNonQuery();

    }

}

 

You are creating a DataTable that matches the type you added to the database. You then join this passed in table to the table you are updating, and the rest is pretty straightforward.