30K Page Views for $0.21: A Serverless Story
fmlnerd.com
fmlnerd.com
The goal being the utility model of computing, pay for exactly the cycles you use, no more, no less. Off premise on demand. Like tap water.
Data traffic is already measured and priced accordingly in AWS so that's not something new for Lambda.
(It's totally understandable and fair that it does; it's just different than what he asked.)
Mainframe budgeting of cycles, memory, an IO was highly effective and efficiently utilizing resources. It's a model of computation that has disappeared, but is still relevant. When google app engine first came I had hoped it would utilize this model, but instead went the containerization route.
Why Sqlite? It's really an awesome database, and using it in process from apache, we can achieve truly massive multi-tenancy, and really low cost.
We also have static file hosting, we're going for hosting of single page apps, but the database API is available over CORS for any domain.
Out of the gate our users get a subdomain on our site. But to serve webapps from a custom domain (ie www.mysite.com), or access the database API from CORS from a different domain, our tentative plan is to charge a small monthly fee (less than $10 a month) and remove the rate limit.
Yes, DDOS mostly, rate limiting is quite trivial.
We've built a tool called panic (https://github.com/gundb/panic-server) to test stuff like this, however correct we haven't finished integrating all the pieces.
Yeah, shoot me a message ( mark AT gunDB DOT io ) now, and I'll send you a ping when we're testing that stuff. :) Thanks for the feedback!
http://blogging.alastair.is/how-i-served-100k-users-without-...
I've been using S3 for serving so much of my web work that I can't believe it has only been 3 years since I learned how to do static page serving on S3.
Slightly OT: If you are less of a ruby guy, what are the go to frameworks in other languages? Especially when you are not looking for blog cms (e.g. pelican or hugo).
If I had to move from Ruby, I think I'd give Lektor (made by the creator of the Python Flask web framework) a deep look. Besides being a static site framework, its creator has endeavored to build a client-friendly GUI, making it a potential way to build static sites that can be maintained by laypersons. It has a very opinionated structure, which had caused me to rethink how I arrange files in my other static projects: https://www.getlektor.com/
Lambda requires a lot of boilerplate and configuration to get things setup. Even when you use Serverless/Apex/Gordon, there's quite a bit of configuration to do. I found ClaudiaJS (https://claudiajs.com/) is much quicker to get up and running and it sets up the API gateways for you based on your API signatures.
A 35mb jar deployment has gotta be painful (zip, upload, deploy). It helps to have a local dev and testing setup off the get go. Once you get past all that, working on your codebase can be fun again.
Paying $0.21 to serve 30k pageviews over a month is dirt cheap.
He did the latter, stop comparing to the former. The smallest VPS you can get is 10$/month.
Otherwise, point taken, but I'd imagine the scenarios where cutting cost by ~$10 or ~$4 per month matters are relatively few.
Serverless is only cost effective in low traffic cases. If you get a stable or high volume of request, a traditional server is way cheaper.
You're also kind of stuck with hash URLs if you want to link to anything in your app.
If you've got a truly single page app hitting an API, or you can generate pages and upload them to S3, you're golden.
But there isn't currently a way of having Lambda serve up dynamically generated HTML pages without some funny business.
I'm sure this will change in the future, but it's stopped me from using it for now.
I know it will still be cheap, but I wonder the increase after the 1-year free tier period expires.
From https://aws.amazon.com/lambda/pricing/ :
>The Lambda free tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month. The memory size you choose for your Lambda functions determines how long they can run in the free tier. The Lambda free tier does not automatically expire at the end of your 12 month AWS Free Tier term, but is available to both existing and new AWS customers indefinitely.
The free tier is actually big enough to run a single 128Mb calculation for 37 days each month.
Similarly, we ran a stress test where we saved 100M+ records a day (~100GB) for about $10 a day (all costs, machines, disk, backup).
How it works - https://www.youtube.com/watch?v=sG5qtN8E-6Q
End/summary of the stress test - https://www.youtube.com/watch?v=x_WqBuEA7s8
S3 + Lambda are gonna be killers!
Hadn't really read about Parse before. It seems it was primarily aimed at mobile developers. Did it have significant use-cases beyond that? In comparison, AWS Lambda, Google Functions, and Azure Functions seem more generically applicable.
As many comments point out there are other ways to do this.
But doing it entirely with AWS primitives of Lambda, S3 and automatic triggers is something very novel and almost certainly the best way to use "the cloud".
you can get 30k pagesviews on GAE/github for paying nothing.
However, then again $0.21 is not very much but, when it could be free...
I guess you could rope some CI service with a free tier into service instead, updating a file on GitHub, but...
I've been thinking about using such public git providers to store small amounts of data, possibly encrypted. For example important documents that I don't want to lose. It seems that it'd be ok as long as you manually create the account.
There was a post here a while ago (that I cannot find anymore) about the devs of a package manager of sorts who were asked kindly by Github to do something about their excessive data usage. So it's probably not a good idea to build a company on it.
(That is what I am inferring from their messages, not necessarily my own opinion)
This can literally run from his laptop whenever it's online. You don't need a fully fledged server to do this.