docker run -p 8087:8087 ghcr.io/vyuvaraj/servpool:latestServPool is a database connection pooler and query routing proxy service of the Servverse ecosystem.
- Connection Pooling: Multiplexes and manages active pooled database connections to reduce startup overhead.
- Read/Write Query Routing: Automatically splits incoming operations (routing mutations to the Primary pool and read queries starting with
SELECTto the Replica pool). - Multi-Database Dialects: Dialect safety checks supporting PostgreSQL and MySQL parameter format checks.
POST /api/db/query- Route and execute an SQL statementGET /api/db/stats- Fetch connection pooling and query statistics per pool
To run the integration tests locally:
go test -v ./...ServPool can be used as a standalone database connection pooler and query router proxy (similar to PgBouncer, but with a REST interface):
-
Configure your Database backend connection details via environment variables:
export DB_PRIMARY_URL="postgres://user:pass@localhost:5432/primary?sslmode=disable" export DB_REPLICA_URL="postgres://user:pass@localhost:5432/replica?sslmode=disable"
-
Start ServPool:
go run main.go --port 8087 --dialect postgres
-
Execute SQL Statements via the REST endpoint:
curl -X POST http://localhost:8087/api/db/query \ -H "Content-Type: application/json" \ -d '{"query": "SELECT * FROM users;"}'
-
Monitor Pool Statistics (active connections, execution counts, replica splits):
curl http://localhost:8087/api/db/stats