chore(lambda): bound the warm pool to 128 idle containers by default (#9173)

This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-22 00:47:29 -04:00
1 parent c4238de1c1
commit b3374d073a
8 files changed
+63 -19

No files matched your search

@@ -3594,15 +3594,16 @@ public interface EmulatorConfig {
* Maximum idle (warm) containers kept across all functions. When a release would push
* the total past this, the least-recently-used idle container of any function is
* stopped first, so the container that just ran (the most likely to run again) stays
* warm. {@code 0} disables the bound; a negative value is ignored with a warning and
* also leaves it unbounded. This bounds idle containers only, emulator-wide. Busy
* warm. The default, 128, keeps a stack of many functions from accumulating one warm
* container per function touched. {@code 0} disables the bound; a negative value is ignored
* with a warning and also leaves it unbounded. This bounds idle containers only, emulator-wide. Busy
* containers are not counted: their ceiling is {@code region-concurrency-limit}, which
* applies independently in each region, so peak container count is this cap plus the
* in-flight invocations across every active region.
*
* Env var: FLOCI_SERVICES_LAMBDA_WARM_POOL_MAX_TOTAL
*/
@WithDefault("0")
@WithDefault("128")
int warmPoolMaxTotal();
/** Docker network to attach Lambda containers to. Empty = default bridge. */
@@ -109,13 +109,18 @@ public class ProvisionedConcurrencyPool implements Resettable {
}
}
/**
* Provisioned environments are not bounded by {@code warm-pool-max-total}, which bounds idle warm
* containers: as on AWS, their ceilings are the function's reserved concurrency and the region's
* concurrency, plus {@code warm-pool-max-per-function} locally.
*/
@Inject
public ProvisionedConcurrencyPool(LambdaRuntimeLauncher launcher, LambdaFunctionStore functions,
LambdaAliasStore aliases, StorageFactory storageFactory,
EmulatorConfig config, Clock clock) {
this(launcher, functions, aliases, storageFactory.create("lambda",
"lambda-provisioned-concurrency.json", new TypeReference<>() {}),
clock, WarmPool.resolveMaxPerFunction(config), WarmPool.resolveMaxTotal(config),
clock, WarmPool.resolveMaxPerFunction(config), 0,
config.services().lambda().ephemeral(), WarmPool.resolveDrainTimeout(config));
}