aws / aws/aws-sam-cli

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

Open
#7,202 1 comment 0 reactions 0 assignees View on GitHub
area/local area/local/start-api area/local/start-lambda type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.