Ok, I have seen the phrase "serverless" a few times recently. Can someone explain to me what it is (as I am pretty sure it involves a server - it runs on AWS ffs) and why I should want to use it? And most importantly, is it web scale?
Well, if you look at how we've done things over the years: - We used to have our own machines in our own data centers - Then we started renting machines in data centers - We then moved to the cloud model where we would get compute capacity on demand. But the minimum unit was an hour - But what if you could deploy your code and you were only charged for the compute and memory you take for the fulfillment of that reque…
Chalice: Python Serverless Microframework for AWS
71–80 of 101 posts
Re: Chalice: Python Serverless Microframework for AWS
#72AWS Lambda is cool and all, but aren't people doing the math on this? Lambda seems like a really expensive way to deliver almost anything. Likewise, the AWS API Gateway is expensive, but at least provides some additional capabilities. Lambda seems like its profitable niche would be very small; limited computing environment, very high cost (relative to almost every other way to host an API), and having to learn a whol…
I've found Lambda to be really ridiculously fucking cheap. We moved image resizing onto it and saved thousands a month. Don't compare the cost of Lambda per 100ms to the cost of a virtual machine per month since Lambda only charges as you use it. You'd have to have the CPU pegged at 100% usage to make that a fair comparison. Mind you even if you took the cost of Lambda per 100ms and multiplied that out for a monthly…
Saying that you can run a 1GB lambda for 1 month nonstop for $32 does not impress me, and its kind of strange that it impresses you.
You could run a t2.micro with the same RAM for $6/mo if you reserve it for a year. And if you want to give that t2.micro a workload where it only has to respond to 1 request at a time, the same terms we are affording the lambda system, then it's no comparison.
Now, for responding to disparate requests every once in a while? Lambda is ideal. You can spin it up and you don't have to pay when it is isn't processing requests. But continuous requests? Hard no.
We can argue that the cost overhead at full load is worth it for the ability to "infinitely" scale with no effort. Alright, that's fine. But let's not pretend that it is "cheaper".
Re: Chalice: Python Serverless Microframework for AWS
#73Earlier quoted context omitted.
I've found Lambda to be really ridiculously fucking cheap. We moved image resizing onto it and saved thousands a month. Don't compare the cost of Lambda per 100ms to the cost of a virtual machine per month since Lambda only charges as you use it. You'd have to have the CPU pegged at 100% usage to make that a fair comparison. Mind you even if you took the cost of Lambda per 100ms and multiplied that out for a monthly…
I would say that it strongly depends on the type of requests you are handling. Saying that you can run a 1GB lambda for 1 month nonstop for $32 does not impress me, and its kind of strange that it impresses you. You could run a t2.micro with the same RAM for $6/mo if you reserve it for a year. And if you want to give that t2.micro a workload where it only has to respond to 1 request at a time, the same terms we are a…
Re: Chalice: Python Serverless Microframework for AWS
#74Re: Chalice: Python Serverless Microframework for AWS
#75Earlier quoted context omitted.
I would say that it strongly depends on the type of requests you are handling. Saying that you can run a 1GB lambda for 1 month nonstop for $32 does not impress me, and its kind of strange that it impresses you. You could run a t2.micro with the same RAM for $6/mo if you reserve it for a year. And if you want to give that t2.micro a workload where it only has to respond to 1 request at a time, the same terms we are a…
I don't have a strong opinion one way or the other, but I'd like to point out that micro instances also have diminished networking (besides processing/memory). Depending on what you're doing, this could be a factor.
Re: Chalice: Python Serverless Microframework for AWS
#76I think I would have preferred this to be some type of plugin/add-on to Flask rather than a full replacement that now locks me to AWS and is a brand new project without any docs :( If it was a cli with decorators or something that uses Flask I would feel more comfortable and give it a shot.
Re: Chalice: Python Serverless Microframework for AWS
#77Earlier quoted context omitted.
Correct. That being said, there's nothing stopping you from emitting, say, HTML from such a function. But there's nothing really helping you either. It's basically function calls in the cloud; a remote procedure call where the remote procedure is executing on their infrastructure.
I'm also guessing there's no session state or cookies?
Re: Chalice: Python Serverless Microframework for AWS
#78Re: Chalice: Python Serverless Microframework for AWS
#79Earlier quoted context omitted.
I've looked into doing this. Flask is too integrated with the WSGI protocol to be easily adapted to this model. It presupposes a number of things about the request and response protocol that are not true in Lambda. You would end up having to write an unwieldy WSGI emulation layer (what Zappa did) and still wouldn't be able to achieve 100% WSGI compatibility, breaking a subset of the plugins. Most people love Flask be…
You're not wrong, but there are plenty of examples of using Flash without WSGI. I use Flask-Frozen to generate static sites from the CLI, for example.
Serving a Frozen app on lambda means serving static files on lambda, which is very doable, and a very different use case than developing something like an API to be deployed to lambda.
Edit: Re-reading our comments, you may be confusing the difficulty -- it isn't in building the CLI for Flask, it's in getting Flask to be served over lambda. Presumably, the OP could easily re-write the deploy functionality to deploy a flask application, it's just that the flask application is unlikely to work because it defaults to WSGI, which lambda (apparently) does not provide.
Re: Chalice: Python Serverless Microframework for AWS
#80Ok, I have seen the phrase "serverless" a few times recently. Can someone explain to me what it is (as I am pretty sure it involves a server - it runs on AWS ffs) and why I should want to use it? And most importantly, is it web scale?
With Lambda you pay per 100ms / per-1-million-requests. So, yes, it's very proprietary at the moment, but for any service that sits idle most of the time it can be very cheap. https://aws.amazon.com/lambda/pricing/ If you were hosting something like a little message board for your friends and family, or something you are demoing to to possible employers, etc, it'd be borderline free, but available all the time.
For that, Lambda is great. We have lowered our price since migrating to Lambda for this relatively simple script.