10 ms·
30K Page Views for $0.21: A Serverless Story
- tapirl 10y agonot cheap you can get 30k pagesviews on GAE/github for paying nothing.
- jon-wood 10y agoThe title is actually understating things a bit. This is $0.21 dollars both for ~30k page views of a static file, but also a fairly involved data processing pipeline which feeds into the generation of that static file.
- diggan 10y agoNot sure why this even needs a backend though, as the post above you mentions, this could be made all in the frontend. Doesn't seem like very complicated math. However, then again $0.21 is not very much but, when it could be free...
- detaro 10y agoHow do you scrape external websites in the frontend? I guess you could rope some CI service with a free tier into service instead, updating a file on GitHub, but...
- imtringued 10y agoIt should be possible to scrape the data with AWS lambda and then just push the results onto github and let the browser deal with the data. All for free.
- detaro 10y agoright, the delivery to the end user clearly could be optimized. I probably interpreted the parent comment wrongly.
- cesnja 10y agoIs such use of Github in compliance with their terms of service? 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.
- flipp3r 10y agoThere are even package managers which host all their data / indexes on Github ( https://github.com/CocoaPods/Specs/tree/master/Specs https://github.com/CocoaPods/Specs/tree/master/Specs ). I personally also back up encrypted data on Github.
- admiun 10y agoNot really although you probably need to use quite a bit of traffic before it becomes a problem. Your example of personal use only seems fine. 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.
- mnkmnk 10y agoIt was probably this- https://github.com/CocoaPods/CocoaPods/issues/4989#issuecomment-193772935 https://github.com/CocoaPods/CocoaPods/issues/4989#issuecomm...
- icebraining 10y agoThat sounds inefficient. Why force every client to repeat the work that can be done once on the server?
- pyrale 10y agoThat sounds like working for $0.21 a month, since if you don't get rid of lambda you don't really create an alternative.
- tapirl 10y agoyes, on GAE, this is far under the free quota.
- pjc50 10y agoThe interesting thing is "serverless" batch processing. Amazon have essentially reinvented the 1970s mainframe batch processing business model, complete with charging for CPU usage. And made it fairly readily available for any developer anywhere.
- marktangotango 10y agoAlmost, does lambda track resource usage down to cpu cycles, heap usage, and network bandwidth? I've contemplated adding scripting language support for my BaaS project with this level of accounting, but from what I've determined, it would require creating a new language, or a new runtime for an existing language, or Lua. Lua's is simple and easier to modify from what I can tell. Unfortunately, no ones writing web apps in Lua, aside from the OpenResty guys. 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.
- admiun 10y agoThey do, yes. Rounded up to the nearest 100ms, scaled for chosen RAM capacity: https://aws.amazon.com/lambda/pricing/ https://aws.amazon.com/lambda/pricing/ Note that this doesn't measure actual RAM use, although they do display it after lambda runs. Data traffic is already measured and priced accordingly in AWS so that's not something new for Lambda.
- sokoloff 10y agoThat's not exactly what marktt was asking. For example, calling sleep (explicitly or implicitly while waiting on network input) would not incur much CPU cost under marktt's accounting method but does incur wall clock charge under Lambda. (It's totally understandable and fair that it does; it's just different than what he asked.)
- michaelt 10y agoOne could think of Lambda as charging for (A * network bandwidth + B * RAM usage * wall clock time + C * CPU time + D * Disk IO) where C and D are both zero.
- pmelendez 10y ago"The Free Tier – My whole scheme doesn’t work without the free tier" I know it will still be cheap, but I wonder the increase after the 1-year free tier period expires.
- pyrale 10y agoIIRC lambda's free tier is not currently timed.
- wongarsu 10y agoThis is a free tier that's not limited to the usual one year period. From https://aws.amazon.com/lambda/pricing/ 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.
- dexterdog 10y agoWithout the free tier that would only cost you $6.66 anyway so if your model can't work without the free tier existing it's probably not a model.
- saynsedit 10y agoWhy is this not a single Python script on a cron that uploads to github pages?
- Buge 10y agoThen you have to pay for a server to run the cron jobs which would be more expensive. You could run it from home, but then you need to manage uptime yourself.
- saynsedit 10y agoA simple cron job doesn't require managing uptime. It just needs to run frequently enough and then upload the generated HTML to github. I'm sure he uses his laptop at least once a day. This is crazy!!!
- Jtsummers 10y agoI don't know about OP, but I know that I often don't use my (personal) laptop once a day. I think I went a month earlier this year where I only touched it twice, and that was to move it out of the way so I could write a letter at that desk. Setting up something like this that's so inexpensive is a reasonable selling point for hobby projects that fit the model AWS has been designed for.
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- sp332 10y ago"Data is typically made available at different days/times throughout the week by different external sources, so each Collector is triggered by a CloudWatch cron job." Also it's in Java, but the author mentions at the bottom that python would be better if you need low latency.
- cagataygurturk 10y agoRegarding to JAR file size, you could use minimizeJar flag of maven-shade-plugin, add only needed aws sdk artifacts as dependency. You could also use https://github.com/lambadaframework/lambadaframework https://github.com/lambadaframework/lambadaframework which is the JAVA-AWS Lambda framework I created.
- aleem 10y ago21 cents isn't the true cost but cool nonetheless. He's on the free tier available to new signups for up to a year. For that matter he could have run it on T2.micro and it would still have cost pennies. Still, a neat setup. (Edit: Lambda's free tier isn't time limited, as noted in other comments below) 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/ 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.
- hipjiveguy 10y agoThanks for the claudiajs link - that's nice and tons of examples too!
- zepolen 10y agoPaying $0.21 to serve 30k pageviews over an hour is expensive. 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.
- vidarh 10y agoThe smallest VPS I found by checking a single provider clocked in at GBP 2.99, or $3.89. Otherwise, point taken, but I'd imagine the scenarios where cutting cost by ~$10 or ~$4 per month matters are relatively few.
- ViViDboarder 10y agoI know Scaleway is €2.99. Curious to know who is £2.99?
- wahnfrieden 10y agohttps://billing.prgmr.com/index.php/order/main/packages/xen/?group_id=10 https://billing.prgmr.com/index.php/order/main/packages/xen/...
- unethical_ban 10y agoSmallest VPS at DigitalOcean and Vultr is $5/mo.
- brassic 10y agoI pay $15/year for a VPS at ramnode.
- retroafroman 10y agoThey're cheaper than that, if you're willing to deal with shady(ish) companies: lowendbox.com
- nogox 10y agoThat's the point. 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.
- danso 10y agoFrom 2013: "How I served 100k users without breaking the server- or a dollar bill." (on S3) http://blogging.alastair.is/how-i-served-100k-users-without-crashing-and-only-spent-0-32/ 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.
- stadeschuldt 10y agoDo you use any particular framework to generate the static pages like jekyll or middleman? 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).
- danso 10y agoI use Middleman almost exclusively. It gives me almost the simplicity of Jekyll but with all the flexibility of writing and including Ruby whenever I feel like it (which can be bad...). I've written things that are almost akin to a small read-only Rails app except the data is stored as YAML files. 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/ https://www.getlektor.com/
- MatthewRayfield 10y agoUnfortunately Lambda falls apart a bit when you want to do any on-request HTML generation. 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.
- adzicg 10y agoAPI gateway takes a bit to set up, and there are silly limits on error responses etc still, but returning a html page is very easy. Check out the web HTML example project for Claudia https://github.com/claudiajs/example-projects/blob/master/web-serving-html/web.js https://github.com/claudiajs/example-projects/blob/master/we...
- nzoschke 10y agoThis is a great writeup and really demonstrates how "the cloud is the computer". 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".
- overcast 10y agoWhat an unfortunate domain name, my first thought was "Fuck My Life Nerd", not "Fantasy Movie League Nerd".
- bikamonki 10y agoIf serverless is a paradigm shift, why did FB killed Parse and left the business? A question that remains unanswered...
- Jtsummers 10y agoNot their core business? Their version wasn't profitable enough? 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.
- marknadal 10y agoThis is pretty neat, stuff like this is slowly creeping in and going to cause dramatic decreases in costs not just for startups but enterprises a like. 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 https://www.youtube.com/watch?v=sG5qtN8E-6Q End/summary of the stress test - https://www.youtube.com/watch?v=x_WqBuEA7s8 https://www.youtube.com/watch?v=x_WqBuEA7s8 S3 + Lambda are gonna be killers!
- superflit 10y agoThere is an excellent Django package/adaptation for Lambda or serverless mode [1] [1] - https://github.com/Miserlou/Zappa https://github.com/Miserlou/Zappa