Ausflug in Tierpark <STOP> Viel zu sehen <STOP> Äffchen, Babyschweinchen, Mini-Kängurus, Otterkinder … alles dabei <STOP> Baby interessiert, aber nur mäßig <STOP> Reißverschluss, Schlüsselbund oder Strohhalm dauerhaft mehr Aufmerksamkeit geschenkt <STOP> Großer „Aaaaawww“-Moment für Mama und Papa <STOP> Befreundetes Babymädchen verabschiedete sich vom Baby spontan per Umarmung <STOP> Und brachte Baby damit komplett aus dem Konzept <STOP>
Tocotronic haben ein neues Lied geschrieben <STOP> Scheinbar kennen die vier das Baby <STOP> Handelt nämlich zweifellos vom Baby <STOP> „Wir sind Babys, sie verstehen uns nicht, wir spucken ihnen ins Gesicht“ <STOP> Insbesondere heutiger Nachmittagsbrei war offenbar als Hommage an Tocotronic gedacht <STOP> Immerhin beweist Baby Musikgeschmack <STOP>
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.
Conclusion
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?
Use SQL Server as data store, but only two small databases (less than 50 MB in size each)
Both applications have one ore more small EXEs that do some background work every few hours
Both applications have small memory and CPU requirements
Both are just side-projects of mine. I don’t earn any money with them. I don’t want to spend a lot on them, too
„This is a perfect fit for Azure Web apps“, I say to myself. I’ve been playing around with Azure for a couple of years, but never for „production“. And I never had to spend any real money on it, because my playing-around all ran on my employers free MSDN credits.
For those who are not familiar with Azure Web apps
Azure Web apps is a PaaS service for hosting ASP.NET / PHP / Java / Node.js web applications. You don’t have to take care of any OS or web server, just deploy your application and Azure runs it, including options to scale it up if needed. It also supports so called WebJobs, which are background tasks (scripts or EXEs). Azure Web apps can be deployed via FTP, WebDeploy or directly from GitHub source code.
In addition, Azure offers a PaaS edition of SQL Server (actually not really SQL Server, but something so similar that the differences don’t matter to me).
By the way, Azure Web apps were called „Azure Websites“ until a few weeks ago.
My Azure setup and my problems with it
Azure Web apps offer a free tier, which is great for playing around with it. But as soon as you want to use your own domain, you will be charged. The smallest tier Shared only costs a few Euros a month, which, in my opinion, is quite reasonable.
There is no free tier for SQL Server, but again, the smallest tier Basic is very affordable, even for some side-project.
So I set everything up on Azure.
One big plus of Azure is its deep integration within Visual Studio. Creating a new Web app and deploying your project takes just a few clicks. But I use GitHub and AppVeyor, so that is of no big use to me. Luckily, Web apps support WebDeploy, so all I have to do is to create the Web app via the Azure management portal and to configure the deployment in AppVeyor, wait for the next build (the free tier of AppVeyor always takes a few minutes before a build starts) and voilá – my Web apps are up and running.
And then the problems start.
The smallest tier of the PaaS SQL Server on Azure is apparently quite limited. Less in the way of features, but more in the way of performance. I cache heavily in my applications (mostly good old, simple ASP.NET Output Cache) and in general think thrice about every call to the database I make. But still, the database server can’t handle the load (about 60 requests per minute, but most of them cached).
It takes me a while to find the cause of all the timeout error messages in my application („The wait operation timed out“), because only Azures new preview management portal displays the necessary information. Well, one of my two databases is at almost 100% resource utilization (Azure calls them DTUs). I try to further optimize my code, but to no avail. I have to switch to a higher, more expensive SQL Server tier. At least that solves my database issues.
Then suddenly the ComicSyndicate application is down and returns only a blue Azure error message („The website has been stopped“). Again, it takes me a while to identify the cause, because this time only Azures old management portal shows me the information. But it seems that running ComicSyndicate requires more than the allowed 512 MB of RAM. I remove a few less vital components (NewRelic and AppInsights performance monitoring among them) and that brings ComicSyndicate down to about 450 MB of RAM. But every time I do a new deploy, it goes over the limit again and I have to wait 30 minutes to let the limit reset itself.
The thing is: On my local machine the application only takes about 150 – 300 MB of RAM (I looked at the TaskManager and the w3wp-Process), even when under load (only artificial load, of course). I have no idea where the high RAM utilization on Azure comes from, maybe parts of the OS or IIS count towards it, too?
Others seem to have similarproblems. And it definitely is a serious one for me. I move my background jobs into a different Web app (one on the free tier) to lower RAM utilization. This helps a little, but still is a big hassle and complicates my deployment. It even seems to me that the WebJobs require RAM even if they are not running, but I’m not sure about that. Of course, these problems will go away if I switch to a higher tier, but it will be far more expensive, too.
One of my background jobs uses PhantomJS (via Selenium webdriver) for some website scraping. Internally, the webdriver starts the PhantomJS EXE and uses HTTP/REST over some special port to communicate with it. This absolutely doesn’t work inside an Azure WebJob (I posted a question on StackOverflow), although I’m not sure if launching another EXE from a WebJob is blocked or just the network communication between WebJob and PhantomJS. I think this limitation is „by design“ and a problem I will not be able to solve with WebJobs. I guess I need my own VM and OS for this kind of „advanced background job“. But that kind of goes against the entire idea why I want PaaS in the first place.
To summarize my problems with Azure
The smallest SQL Server tier provides only a very basic level of performance. More money solves this problem.
The smallest Web app tier provides only limited RAM resources and those are not enough even for my fairly basic application. (A lot) more money would have solved this problem.
WebJobs are limited in what they are allowed to do.
Different set of features on the two very different Azure management portal. This will, I guess, get better as soon as the new portal is out of preview.
What I like about Azure Web apps
There are very affordable or even free tiers for most services.
Deep integration into Visual Studio, but Visual Studio is no requirement. In general, deployment is very easy, especially „Deploy from GitHub“ is awesome.
It’s dead-easy to scale the PaaS (either manually or automatically). Although I probably will never need it for my tiny side-projects.
What it costs
2 Web Apps (Shared): 14.41 € / M
1 SQL Server database (Standard): 11,18 € / M
1 SQL Server database (Basic): 3,73 € / M
I don’t count any storage or bandwidth costs, because those are negligible. All in all my scenario costs about 30 € a month. Not included is the VM I will need to run my „special“ background task, the smallest Windows VM on Azure is about 10 € a month.
I’m not happy. So I start looking for alternatives.
In the second part of this post I write about my move to AWS and my problems there. Because there are always problems, aren’t there?
Donnerstag ist bekanntlich Mühlviertel-Oma-Tag <STOP> Auch am Feiertag <STOP> Dann ausnahmsweise inklusive Mama <STOP> Will ebenfalls bekocht werden <STOP> Mühlviertel-Oma bietet noch andere Annehmlichkeiten <STOP> Beispielsweise Garten <STOP> Abreise selbstredend erst nach Plünderung der gärtlichen Erzeugnisse <STOP> Und nachdem Mama und Papa Baby mit dem Gartenschlauch sekkiert haben <STOP> Solange bis Tränen kamen <STOP> *tztztz* <STOP>
Verregnete Tage <STOP> Albtraum eines jeden Karenzpapas <STOP> Baby schert sich nicht um Wetter <STOP> „Ich will raus, jetzt sofort, Kruzifix“ <STOP> Fordern Augen sowie aufgebrachtes Brummen <STOP> Verzweifelte Suche nach regenmeidender Variante <STOP> Museum? <STOP> Jemanden besuchen? <STOP> Runde mit der Straßenbahn? <STOP> Heute beispielsweise kurz Runden gedreht am Gang <STOP> Bis schlimmster Regenguss vorbei war <STOP>
Urfahraner Jahrmarkt in der Stadt <STOP> Urfix <STOP> Letzte Woche <STOP> Baby zwar noch zu klein für St. Petersburger Schlittenfahrt <STOP> Zum Hören und Sehen aber auch so genug <STOP> Mit großen Augen verfolgt Baby eine beeindruckende, grandiose Attraktion nach der anderen <STOP> Papa, wie er Bratwürstl isst <STOP> Papa, wie er Riesen-Bosner isst <STOP> Papa, wie er Softeis isst <STOP> Papa, wie er Mini-Donuts isst <STOP> So ein Jahrmarkt ist was Tolles <STOP>
Nuckibärs großes Abenteuer <STOP> Während Ausfahrt vom Kinderwagerl gesprungen <STOP> Verschwinden erst viel später entdeckt <STOP> Große Vorwürfe bei Mama und Papa <STOP> Ach, wieso war Nuckibär nicht vernünftig angegurtet? <STOP> Sofort umgedreht <STOP> Weg abgegangen <STOP> Hoffnung schon aufgegeben <STOP> Dann doch noch Happy End <STOP> Nuckibär wartete allein am Linzer Hauptplatz <STOP> Riesige Wiedersehensfreude bei Mama und Papa <STOP> Baby hat Nuckibärs Abwesenheit nicht einmal bemerkt <STOP>
Muttertag <STOP> Baby hat die hoch gesteckten Erwartungen von Mama aber nicht erfüllt <STOP> Weder Frühstück ans Bett <STOP> Noch freiwillig Hausarbeiten <STOP> Nicht mal ein Gedicht <STOP> Enttäuschung aber sofort verflogen <STOP> Als Baby noch im Bett den ersten morgendlichen, verschmitzten Grinser ausgepackt hat <STOP> Gut, dass Mama sich auch mit so etwas zufrieden gibt <STOP>
Große Wiedersehensfreude <STOP> Wenn Baby nach längerer Abwesenheit bei den Großeltern wieder die Mama erspäht <STOP> Grinsen verschwindet gar nicht mehr <STOP> Und ganz viele Bussis <STOP> Papa wird zurückhaltender begrüßt <STOP> Per Handschlag und freundlichem, aber reserviertem Nicken <STOP> Unter Männern ist man eben weniger emotional <STOP>