Live data from Hacker News

Chalice: Python Serverless Microframework for AWS

aws.amazon.com

61–70 of 101 posts

Re: Chalice: Python Serverless Microframework for AWS

#61
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 request? That is what the "serverless" model is. You don't constantly run a server like apache; instead, when you receive a user Request, the relevant function is called, executed and results returned to the user. You are billed for the ram ⨉ CPU.

This has many benefits:

- For low traffic sites, this has significant cost savings

- For high traffic sites, this is auto-scaling without thinking about launching machine instances

This isn't without problems, naturally. This lends itself well to certain type of problems better than others. For example, if you need lots of hot-cache data, the response times on a serverless stack would be slower.

But as you can see from the above, this is the logical direction cloud computing will evolve. Infrastructure will truly be shared and you should be able to extract efficiencies down to the minute.

Re: Chalice: Python Serverless Microframework for AWS

#63
post #54

Earlier quoted context omitted.

google micro (1 cpu, 0.6GB ram): $0.006/hr amazon nano (1 cpu, 0.5GB ram): $0.0065/hour https://cloud.google.com/compute/pricing https://aws.amazon.com/ec2/pricing/ in both cases, +disk, +traffic Not exactly a crippling difference.

Oh interesting...are nano instances new? Didn't see them last time I was looking for a "just throw up a demo" machine.

They've been around for a few months, but like all new AWS things, they're being slowly rolled out across regions, so may not be available everywhere. Flick through the 'region' dropdown in that pricing link to see if they're available where you want them.

The micro went from 0.6G to 1G ram in the 't2' generation, and the nano fills the need people have for the old micro size. I use them for bastion/nat boxes :)

Re: Chalice: Python Serverless Microframework for AWS

#64

Earlier quoted context omitted.

I am not sure about the frameworks, but a lambda function is just that, a function. You can easily run your function and pass in an event object (a dict in Python) to test various scenarios. You don't need to deploy to test. Once you are ready you can deploy to lambda without publishing to fully test before publishing live.

Thank you. Are these not meant to render user interfaces and just be for API-style computing?

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.

Re: Chalice: Python Serverless Microframework for AWS

#65

Earlier quoted context omitted.

I am not sure about the frameworks, but a lambda function is just that, a function. You can easily run your function and pass in an event object (a dict in Python) to test various scenarios. You don't need to deploy to test. Once you are ready you can deploy to lambda without publishing to fully test before publishing live.

Thank you. Are these not meant to render user interfaces and just be for API-style computing?

I am currently using it for what you could probably call a user interface. My use case is forms stored in S3 served as an iframe which POST via JS to AWS API Gateway that calls lambda to process the form and return the result to the user.

Re: Chalice: Python Serverless Microframework for AWS

#66
post #64

Earlier quoted context omitted.

Thank you. Are these not meant to render user interfaces and just be for API-style computing?

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.

[deleted]

Re: Chalice: Python Serverless Microframework for AWS

#67
post #64

Earlier quoted context omitted.

Thank you. Are these not meant to render user interfaces and just be for API-style computing?

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

#68

Question: With these "Serverless" frameworks (Zappa, Chalice, Serverless, etc), do you have to redeploy to Lambda every time you want to test your changes during development? Is there a way to develop locally and get quick feedback?

I am not sure about the frameworks, but a lambda function is just that, a function. You can easily run your function and pass in an event object (a dict in Python) to test various scenarios. You don't need to deploy to test. Once you are ready you can deploy to lambda without publishing to fully test before publishing live.

But if you want to emulate the aws gateway + lambda cycle locally it seems like you need a bit of rigging to do this easily, especially if you want to talk to it with your browser.

Re: Chalice: Python Serverless Microframework for AWS

#69
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…

What makes you say Lambda is more expensive than things like EC2? Obviously lambda is a hammer, not a swiss army knife - you shouldn't shoehorn it into your app just because it's the new tech on the block. But the use case isn't niche at all. We're using lambda for our service to ingest and process Hearthstone replays. An HTTP POST is sent to the API gateway, this triggers a lambda which parses a 0.5-2MB file, scrape…

I've got (virtual) servers all over the place. I run my tiny little "needs a minute" tasks on one or more of those. It's nice, I guess to make it a wholly isolated thing, but I rarely actually want to go to the trouble to design it to be isolated. My little jobs often need at least some of the rest of my production environment to be available (database, logs, libs, something). Making a Lambda thing just for those things seems like something I'd rarely want to go to extra effort for.

But, if building on a very large scale with strict isolation requirements for your individual tasks it would make sense. Which is the niche I'm talking about; maybe it's just bigger than I assume it is.

Re: Chalice: Python Serverless Microframework for AWS

#70
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 think the appeal of Lambda is that most services get zero-to-low usage, and so something which is "pay only for usage" may be a net win over dedicated computing resources if you use it for the right parts. I've had a number of startup ideas that went nowhere, and it would've been handy to test & demo them without springing for the full $17/month for an EC2 t2.micro instance. Usually they have some key aspect that's…

As already mentioned, $4-$5 gets you a tiny instance all month. But, for me, I just run my small jobs on my existing virtual machines, generally speaking. I have a bunch of servers, they already have my necessary libraries, files, and database information and caching and such setup. Running a cronjob, or something triggered or pulled from a queue, is trivial and practically free.

My feeling on this is that if the job is small enough and infrequent enough, I don't care about its impact on other services so I can run it anywhere (and it's effectively free in such a case), and if it's large enough and frequent enough then setting up for it in Lambda every time is wasteful and I probably want a system (even if a small one) dedicated to the job, for probably less money. There's probably a sweet spot in there somewhere...but, it's not high on my list of things to integrate into my infrastructure.

Post reply on HN