Feature request: switch to add SO_REUSEPORT to main socket in local start-lambda / start-api #7202
Labels
area/local/start-api
sam local start-api command
area/local/start-lambda
sam local start-lambda command
area/local
type/feature
Feature request
Describe your idea/feature/enhancement
I wish SAM CLI (local start-lambda) would provide an option to add the SO_REUSEPORT socket option to the main socket.
This would be a quick and dirty way to solve the desire of many people to have warm lambda containers,
yet still be able to send/request multiple concurrent lambda invocations.
The way you would use this is to start multiple SAM sessions, but with the SO_REUSEPORT set,
and the --warm-containers setting set, so that each invocation of sam would create a lambda container for each lambda.
This isn't as good as having the sam process manage a "fleet" of lambda containers, but it approximates it,
and would let you also simulate (imperfectly) having a fixed reserved concurrency.
It's imperfect because a request might go to an already-busy (sam) lambda, instead of one that's idle.
Also, you don't get the failures you get with a real concurrency limit.
Proposal
It might be as simple as adding a switch, and verifying that this does what we want
(i.e. that the independent sam invocations can coexist otherwise, and create their own redundant container lambdas).
I think this would be great if the team agrees to it, it would help satisfy what I see as a real desire to make lambdas
in the development environment be more multi-processing, to better simulate real lambda invocations.
Of course, I'm in the camp of those who would like SAM to better approximate a real lambda environment,
on the theory that the development environment should mimic the real one as much as possible.
The text was updated successfully, but these errors were encountered: