News for hackers. Stuff that matters.
Re:Ruby on Jets: Like Rails but Serverless by jacobn on Saturday January 21, 2023 @11:19PM (#34474224)
Does it really make sense to map each controller method to a lambda? Wouldn’t it make more sense to have gateway route to a single function per controller and then do the method routing inside that function? You’re going to get a lot of lambda functions otherwise.
Re:Ruby on Jets: Like Rails but Serverless by astuyvenberg on Saturday January 21, 2023 @11:56PM (#34474448)
It's typically fine - AWS bills by GB/s (in ms), not by number of functions in an account.

There are limits to the number of functions per account, and number of resources per CloudFormation stack (etc); but within those parameters it's usually a good idea to use one function for a specific controller or action. This allows you to limit IAM permissions, configure memory/CPU, and define associated resources at a per-controller level.

Re:Ruby on Jets: Like Rails but Serverless by bigfoot675 on Sunday January 22, 2023 @12:17AM (#34474558)
You will definitely run into more cold starts though, if that is a consideration for your project
Re:Ruby on Jets: Like Rails but Serverless by philwelch on Sunday January 22, 2023 @01:25AM (#34474936)
A serverless function that never cold-starts is just a container.
Re:Ruby on Jets: Like Rails but Serverless by KyeRussell on Sunday January 22, 2023 @01:48AM (#34475046)
That doesn’t mean that more cold starts aren’t bad.
Re:Ruby on Jets: Like Rails but Serverless by philwelch on Sunday January 22, 2023 @04:08AM (#34475650)
Sure but if you can’t tolerate the added latency of a cold start, serverless might not be right for you.

Conversely, if you’re doing something like processing message queues and you don’t care about latency at all, serverless is perfect.

Re:Ruby on Jets: Like Rails but Serverless by aa_memon on Saturday January 21, 2023 @11:58PM (#34474460)
I'm guessing it also helps keep deploys small (atomic?) when a controller method changes. The unmodified lambdas stay untouched.
Re:Ruby on Jets: Like Rails but Serverless by foolfoolz on Sunday January 22, 2023 @12:44AM (#34474709)
this makes logging much more difficult to search through
Re:Ruby on Jets: Like Rails but Serverless by stretchwithme on Sunday January 22, 2023 @12:56AM (#34474773)
maybe this will eventually have an algorithm for deciding when to deploy separately and when not to, based on cost, performance, etc.
Re:Ruby on Jets: Like Rails but Serverless by latchkey on Sunday January 22, 2023 @12:57AM (#34474776)
I've built some nice small frameworks for projects on both CloudFlare Workers and GCP Functions that do exactly this. They are so simple to build that I can't imagine needing to even open source them... but maybe should write up a blog post on the details at some point. So many people seem to miss this detail for some reason.

The main benefit is that it sure is a lot easier/faster to deploy one function than one for each route (CI/CD goes so much faster). As well as the cold starts.

Re:Ruby on Jets: Like Rails but Serverless by fishnchips on Sunday January 22, 2023 @05:02AM (#34475918)
Nothing prevents you from routing everything to a single function, no need to even split by controller.

The disadvantage of having a huge number of Lambdas is the ratio of cold starts. The advantage is that you can granularly tweak resource utilization on a per-operation basis.

Re:Ruby on Jets: Like Rails but Serverless by brianshaler on Sunday January 22, 2023 @06:03AM (#34476205)
> granularly tweak resource utilization on a per-operation basis

This is a really good point. Either I took a thorny path learning Lambda or they don't make it terribly obvious that when you pre-allocate larger amounts of RAM (thus more $$$ in GB/s cost) you also gain substantially better CPU performance.

So when you have a compute intensive task with a low memory footprint and want to improve latency, you may actually want to allocate lots of unused RAM.

Re:Ruby on Jets: Like Rails but Serverless by dgb23 on Monday January 23, 2023 @04:12AM (#34486889)
I don’t know how this works. But I’m curious:

Wouldn’t it be more cost effective to have one big address space than a lot of fine tuned ones? Even if you’re stateless, you could benefit from the fact that utilization spikes can be handled with less overall redundancy. Assuming the dollar cost is proportional per allocation.

Re:Ruby on Jets: Like Rails but Serverless by andrew_ on Sunday January 22, 2023 @09:20AM (#34477630)
provisioned concurrency pretty much nukes the concern.
Re:Ruby on Jets: Like Rails but Serverless by soxocx on Sunday January 22, 2023 @09:52AM (#34477904)
This is not as trivial as you make it sound. You would need to know the amount of functions you want to have provisioned at all times, if you need more, cold starts will occur. In addition this creates base costs, which would not exist otherwise.
Re:Ruby on Jets: Like Rails but Serverless by andrew_ on Sunday January 22, 2023 @02:54PM (#34481557)
I would argue that if you needed n number of functions, where n is unknown, or n cannot be set to a reasonable number that can handle traffic, and cold starts are unacceptable, you would be using the wrong bit of infrastructure.
Re:Ruby on Jets: Like Rails but Serverless by soxocx on Thursday January 26, 2023 @09:49AM (#34532259)
I agree. Usually it is a a trade-off between cold starts and the costs of `n` warm functions.