4 minutes
Hyperscale dirt cheap serverless setup
Hyper Hyper
I’ve been asked by a friend to have a look at their hosting concept for this very simplistic, almost entirely Web-Based, Desktop & Mobile App Backend.
Of course there was lots of talking from their IT staff about Dedicated Servers and such. No wonder the preliminary cost estimates were somewhere in the 1K USD MRC range… Without even having paying customers yet…
So I looked at their tech-stack and to my surprise their stack is almost entirely based on JavaScript or TypeScript in one way or another. Mobile App? React Native - Web App? NextJS …
I followed up on understanding what it actually is that they want to provide to their end-users and it turns out it’s just pretty formatted DB queries. Personalized ofc.
Now this just screams Serverless to me at this point. Pack a CDN in front, serve everything from Object Storage and have an API-GW trigger Serverless applications to hammer the DB.
Wait Really? Yes!
To me this is textbook serverless. There’s no need for continuous computation and every interaction from an end-user is to fetch a dataset or more from the DB. They dont even update records or anything, this is pure RO (but private/authenticated) traffic!
So why would you want any servers here? They’re going to rake up costs by being idle just in case somebody decides to check the App… That’s just a money sinkhole. But it represents very well how traditional IT is still very much present in the minds of even young engineers.
I drafted a design based on just the above with a bit more fluff in the back because data does actually come into DB from a different vector - namely a cronjob… :|
They looked at it and whilst the Execs and my friend were all excited and amazed by all those super fancy buzzwords like Serverless, Object Storage, CDN, API-GW, … The engineer was a bit skeptical, which is good(!), and ultimately the question of cost - not just to run but also to operate - arose.
Luckily Stockholm IT is a small village, literally. So I made some calls to AWS/Azure/GCP to have them review my sketch and give me some remarks. After that I just went to their respective pricing calculator and smashed wildly on my keyboard until a quote emerged with the products and services required.
So Why Azure?
This is a very good question and to be honest I drafted this primarily for AWS with CloudFront, S3 and Lambda in mind.
But Oh-My… Azure has become extremely competitive in their pricing. They’re quite literally giving away amazing services that help smaller enterprises get their services running with less overhead and arguably more secure by forcing adoption of 12-Factor App principles.
Their Cosmos DBaaS offering with a serverless Pay-as-you-go model just trumps over AWS Dynamo or similar as you do not have as bulk-cost anymore.
What ultimately won me over to Azure was the fact that if no customers would be visiting the application the base-cost of this whole infrastructure is 1 Redis-Cluster which unfortunately is not serverless. And even that could be skipped and a 2nd CosmosDB could be used for caching instead… Which makes it all serverless and without idle-cost.
I ran the numbers and they can sustain 100.000 Interactions/Month (page visits, data fetches, etc) for barely over 30 USD MRC. That’s less than lunch for two!
And the effective cost per Interaction is hovering around 0.001 USD making it very easy to calculate campaign-convergences and ROIs.
The cost scaling is even near linear making this a very predictive model and through the use of serverless you can scale very big before you need to rethink the setup and commit to a higher base cost
Wait but AWS has…
…Dynamo and Cognito and such!
Well yes it does and it’s also very cheap in that regard but the pricing policy can vary per service.
Azure is very often a blank Pay-Per-Request where AWS is a Pay-Per-Resource-Usage-That-The-Request-Did-Plus-Addons making it hard to proper model.
I feel that AWS has quite a big drag of not-so-obvious cost factors (really want to avoid the term hidden cost here)
Same setup and values on AWS would be shy of 50USD to be specific
Related Posts: