Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: switch to add SO_REUSEPORT to main socket in local start-lambda / start-api #7202

Open
skh1000 opened this issue Jun 26, 2024 · 1 comment
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

Comments

@skh1000
Copy link

skh1000 commented Jun 26, 2024

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.

@skh1000 skh1000 added stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. type/feature Feature request labels Jun 26, 2024
@hawflau
Copy link
Contributor

hawflau commented Jun 26, 2024

Hey Thanks for the suggestion. I'll bring this up with team.

@hawflau hawflau added area/local area/local/start-api sam local start-api command area/local/start-lambda sam local start-lambda command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants