mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 03:28:41 +00:00
[api] Lower default max_connections to 5 on esp32/libretiny
With N=5 the static-RAM trade becomes net-negative at just 1 client (the typical ESP32 deployment — just Home Assistant): +8 B static (5 slots × 4 B − 12 B removed vector object) −12 B heap (8 B header + 4 B slot) at 1 client = −4 B net N=6 had breakeven at 2 clients; N=5 puts breakeven at 1 client so the common case is pure win. 5 slots covers HA + dashboard + 1 reconnecting socket, which is all most deployments ever use. Users needing more can bump explicitly in YAML (schema max is 20). host stays at 8 (no BSS-slot concern). esp8266 stays at 4, rp2040 stays at 4.
This commit is contained in:
@@ -291,12 +291,12 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.SplitDefault(
|
||||
CONF_MAX_CONNECTIONS,
|
||||
esp8266=4, # ~40KB free RAM, each connection uses ~500-1000 bytes
|
||||
esp32=6, # 520KB RAM — 6 is enough for HA + dashboard + a couple of spares
|
||||
esp32=5, # 520KB RAM — 5 slots makes the static-RAM trade true net-negative at 1 client
|
||||
rp2040=4, # 264KB RAM but LWIP constraints
|
||||
bk72xx=6, # Moderate RAM
|
||||
rtl87xx=6, # Moderate RAM
|
||||
bk72xx=5, # Moderate RAM — net-negative at 1 client
|
||||
rtl87xx=5, # Moderate RAM — net-negative at 1 client
|
||||
host=8, # Abundant resources, no BSS-slot concern
|
||||
ln882x=6, # Moderate RAM
|
||||
ln882x=5, # Moderate RAM — net-negative at 1 client
|
||||
): cv.int_range(min=1, max=20),
|
||||
# Maximum queued send buffers per connection before dropping connection
|
||||
# Each buffer uses ~8-12 bytes overhead plus actual message size
|
||||
|
||||
Reference in New Issue
Block a user