Files
floci/docs/configuration
danielxoi 73b8c6124c feat(lambda): bound the warm pool globally with LRU eviction (#4683)
* feat(lambda): bound the warm pool globally with LRU eviction

Adds warm-pool-max-per-function (replaces the hardcoded max(4, cpus)) and warm-pool-max-total (0 = unbounded). When the total would be exceeded, the least-recently-used idle container of any function is stopped before the released one is pooled, so the function that just ran keeps its container. Busy containers are not counted; their ceiling is region-concurrency-limit.

WarmPool now takes a Clock so LRU order and the idle sweep are testable without sleeping.

Closes #4682

* fix(lambda): warn when warm-pool-max-total is negative instead of treating it as unbounded

Math.max(0, value) turned -1 into 0, the documented opt-out, so a mistyped cap silently restored the unbounded pool. Resolve it like warm-pool-max-per-function: a negative value is logged and the total stays unbounded.

* docs(lambda): state the warm-pool peak bound per region

region-concurrency-limit applies independently in each region while warm-pool-max-total is emulator-wide, so a single sum understated peak container count with more than one active region. Describe the cap as an idle-only, emulator-wide bound and the peak as the cap plus in-flight invocations across every active region. Also document that a negative value is ignored with a warning.

* fix(lambda): do not stop a drained container again from the global cap eviction

evictIdleBeyond snapshots each idle deque, then removes the chosen handles under the pool lock. drainEnvironment and drainFunction detach the deque from the pool and stop its contents themselves, so a drain between the snapshot and the removal left the eviction holding the orphaned deque: remove(handle) still returned true and the container was stopped a second time. Check the deque is still the live one for its environment before removing from it.
2026-10-02 16:05:26 -04:00
..