Skip to content

Postgre sql connection pool#94

Merged
elizabetheonoja-art merged 2 commits into
Utility-Protocol:mainfrom
gloskull:PostgreSQL-Connection-Pool
Jul 18, 2026
Merged

Postgre sql connection pool#94
elizabetheonoja-art merged 2 commits into
Utility-Protocol:mainfrom
gloskull:PostgreSQL-Connection-Pool

Conversation

@gloskull

Copy link
Copy Markdown
Contributor

Motivation
Provide a lightweight, reusable PostgreSQL health probe to detect latency and pressure and recommend adaptive pool sizing for services that rely on DB-backed ingestion and settlement.
Meet critical-path performance/availability goals by measuring rolling P99 latency and preventing pool oscillation with a cooldown.
Description
Add PostgresPoolHealthProbe (meter-simulator/src/postgres-pool-health.js) that runs bounded probes, records rolling latency samples, computes utilization and P99, and produces sizing recommendations (scale_up/scale_down/hold).
Expose environment-configurable defaults in meter-simulator/src/config.js under postgresql for probe SQL, timeouts, P99 target, min/max pool size, scale thresholds, and cooldown.
Add unit tests (meter-simulator/tests/postgres-pool-health.test.js) covering healthy probes, probe failures, scale-up/scale-down recommendations, and cooldown-protected sizing application.
Document architecture, configuration variables, example usage, monitoring/alerting guidance, and a runbook in meter-simulator/README.md.
Testing
Ran the new probe test suite with npm test -- --runInBand tests/postgres-pool-health.test.js, and it passed (5 passed).
Ran the full test suite with npm test -- --runInBand; the new probe tests pass but the overall run fails due to pre-existing unrelated failures in meter-device.test.js (examples: bad secret key size from NaCl signing, a peak-hour timestamp expectation mismatch, and a signature message length expectation mismatch).
Closes #64

@elizabetheonoja-art
elizabetheonoja-art merged commit 53a0bdb into Utility-Protocol:main Jul 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostgreSQL Connection Pool Health Probe with Adaptive Sizing

2 participants