Live data from Hacker News

Chalice: Python Serverless Microframework for AWS

aws.amazon.com

71–80 of 101 posts

Re: Chalice: Python Serverless Microframework for AWS

#71
post #2

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…

It's like running CGI on a shared server, except that it scales better.

Re: Chalice: Python Serverless Microframework for AWS

#72
post #6

AWS 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…

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 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

#73
post #72

Earlier 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…

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

#75
post #72

Earlier 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.

We can afford a t2.medium or an m3.medium at the price he quoted, which will have better RAM, processing capability, and probably equivalent networking capability, so that isn't really the takeaway point.

Re: Chalice: Python Serverless Microframework for AWS

#76

I 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.

[deleted]

Re: Chalice: Python Serverless Microframework for AWS

#77
post #64

Earlier 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?

We'll I guess there wouldn't be without a server. You'd have to use JWT or the like.

Re: Chalice: Python Serverless Microframework for AWS

#79
post #50
post #45

Earlier 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.

You may be right overall, but that's a particularly bad example, as Frozen simply eliminates the "flask" portion that gets deployed to the server in lieu of static files, ergo obviating the need for WSGI altogether.

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

#80
post #27
post #2

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?

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.

I have a SaaS running on EC2s/Beanstalk where I have a feature that a user only runs max. a few times per day (if any). It's a small Python algorithm that finds the most optimal combination in an array of items.

For that, Lambda is great. We have lowered our price since migrating to Lambda for this relatively simple script.

Post reply on HN