In the first part of this post I wrote about the ASP.NET applications I want to host in the cloud and the problems I encountered when I tried to do this using Azure Web apps.
I’m not happy, so I start looking for alternatives
By now I know that I’ll have to use „my own“ server / VM / OS if I want to get my special PhantomJS background job to run properly. So I stop to try to solve the problems I have with Azure Web apps and reluctantly bury the idea of a clean and easily scalable PaaS solution.
Of course, Azure offers ready-to-go Windows VMs. The smallest one costs about a reasonable 10 € a month, but offers only a mere 768 MB of RAM. The next tier is already at about 41 € a month, which seems quite expensive to me for only 1.75 GB of RAM.
I search around the Internets for what a decent dedicated Windows server costs these days (about 50 € a month upwards) and immediately stop looking because I absolutely don’t want to spend that kind of money on some low-profile side-projects of mine.
Then I recall that AWS offers a tiny Windows VM for a reasonable price, too. This little server is even free for the first year, but I already have an old AWS account, so I can’t take advantage of that. It is only marginally better equipped than the smallest VM on Azure, but at least offers 1 GB of RAM for about 13 € a month. I’m very skeptical about the performance of this tiny, tiny thing, but I have a few hours to spare and give it a shot.
AWS already provides a ready-to-go image with Windows Server 2012 R2 and SQL Server Express 2014 pre-installed, so I use that to boot a new instance. I haven’t used AWS in years, but was pleasantly surprised about the management portal. Although it looks far less polished than Azures two, it seems faster and snappier to me.
At first, my new mini-server is very slow and I immediately want to give up on it. But after a few minutes it starts to get better and so I begin to move my applications. Since I already use AppVeyor and WebDeploy, I have to
- Install and configure IIS
- Install the WebDeploy agent service
- Install the NewRelic agent service
- Setup up the database
- Configure the background jobs (I run them hourly using the out-of-the-box Windows task scheduler)
- Point my AppVeyor deployment configuration to the new server
and voilá – my applications are up and running again.
True, the PaaS way was far less manual work, but to my considerable surprise, it works. In fact, it works much better than expected. Sure, the initial precompilation and ASP.NET first-runs take quite a while to finish. Also, the first calls to the database completely overwhelm the little box, but then I start to see reasonable performance. Who would have thought that I can ran two ASP.NET applications and an SQL Server instance on just 1 GB of RAM? Well, to be fair, the provided image has a 8 GB page file configured and it’s running on an SSD, but I’m surprised nevertheless.
As I mentioned earlier, I cache heavily in my applications. So the CPU doesn’t have a whole lot to do as soon as the cache is filled. The response times are much better than they were on Azure Web apps. I get a NewRelic Appdex from about 0.95 to 1.0 when under load (~ 70 requests per minute). The response time gets significantly worse for a few minutes after a server reboot (when the database and the cache is cold), but I can live with that.
This AWS setup costs me
- 1 Windows t2.micro instance: ~ 13 € / M
I don’t count any storage or bandwidth costs, because those are negligible (although I think Azure is cheaper here). All in all my scenario costs about 17 € to 20 € a month.
This is what I like about AWS
- I’m running my own server, so even my special background jobs run fine.
- The performance of a single t2.micro instance really impresses me.
- I can run all my application on a single server with no extra costs for additional applications.
What I don’t like
- I’m running my own server, so I have to take care of it, too, including backups, security and patches. This really is a big disadvantage to me, because that is what drew me to PaaS in the first place. I’m a Dev, not a Sys-Admin.
- I loose the ability to scale easily. But as I mentioned earlier, I guess I will never need that.
- There is no one-stop pricing calculator for all AWS services, like the one Azure offers. In general, pricing on AWS seems much more complicated than on Azure.
I never thought I would come to this conclusion, because I still am a big fan of where Microsoft is going with Azure. But at least for my scenario an EC2 instance is much more cost-effective than the Azure PaaS offerings. Would Microsoft offer a cheaper, entry-level VM with at least 1 GB of RAM, no doubt I would have continued to use Azure.
But as things are, I’m fairly happy with this setup (I’ve been running it for a couple weeks now). Last but not least because I can host my next side-project on this one server as well, for no extra cost.
What are your thoughts? Have I missed something? Is there a better (cheaper) way to host my applications?