feat(node-config): add SQL connection pool tuning env vars#139
feat(node-config): add SQL connection pool tuning env vars#139
Conversation
The SQL cold storage pool previously used sqlx defaults (10 max connections, 30s acquire timeout), causing pool starvation under moderate RPC load when 64 concurrent cold-storage readers compete for connections. Add five new environment variables to StorageConfig for tuning the sqlx pool: max/min connections, acquire timeout, idle timeout, and max lifetime. Defaults are tuned for RPC workloads (100 max, 5 min, 5s acquire, 10m idle, 30m lifetime). Also bumps signet-storage dependencies from 0.6.5 to 0.7 to pick up the SqlConnector builder methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 1 issue:
node-components/crates/node-config/src/storage.rs Lines 11 to 21 in b625ca0 The 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
CLAUDE.md prohibits pub(super). Use pub(crate) for the pool_defaults module constants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
work belongs in bin base. add an optional dep on subset storage and a fromenv impl for the connector. @Fraser999 has context and there may already be a ticket
this pr then becomes adding a connector to the config
additional pr needed to add serde to the connector in storage repo
Fraser999
left a comment
There was a problem hiding this comment.
Only a couple of non-blocking points.
The new version of |
This stack of pull requests is managed by Graphite. Learn more about stacking. |

Summary
StorageConfigfor tuning the SQL cold storage connection pool:SIGNET_COLD_SQL_MAX_CONNECTIONS,SIGNET_COLD_SQL_MIN_CONNECTIONS,SIGNET_COLD_SQL_ACQUIRE_TIMEOUT_SECS,SIGNET_COLD_SQL_IDLE_TIMEOUT_SECS,SIGNET_COLD_SQL_MAX_LIFETIME_SECSsignet-storagedependencies from 0.6.5 to 0.7 to use theSqlConnectorbuilder methodsContext
The sidecar RPC's cold storage task spawns up to 64 concurrent readers, all sharing the sqlx pool. With the previous default of 10 connections, 54 readers would block waiting for a free connection (up to the 30s acquire timeout). Combined with the write-drain behavior (every new block drains all in-flight reads before writing), this created cascading stalls under even moderate load.
Test plan
cargo +nightly fmt -- --checkcargo clippy -p signet-node-config --all-targets(default features)cargo clippy -p signet-node-config --all-targets --features postgrescargo t -p signet-node-configRUSTDOCFLAGS="-D warnings" cargo doc -p signet-node-config --no-depsSIGNET_COLD_SQL_MAX_CONNECTIONS=100and verify pool starvation is resolved🤖 Generated with Claude Code