agentsclimarketplace

Connection pooling

Skill Amey-Thakur/AI-SKILLS/skills/performance/connection-pooling

Plug-and-play skills and prompts for every AI coding agent

Install
npx -y skills add Amey-Thakur/AI-SKILLS --skill connection-pooling

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 21 days oldThe repository was created 21 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Size connection pools from throughput and latency math, then monitor for saturation and set timeout policy so a slow dependency fails fast instead of hanging. Use when a service exhausts database connections, requests queue for a connection, or pool size was picked by guess.

SKILL.md

3.0 KB, 621 tokens by cl100k_base, as published. Nobody here has run it

Connection pooling

A connection pool trades a fixed set of expensive, reusable connections against unbounded on-demand ones. Size it too small and requests starve waiting for a slot; too large and the database drowns in connections it cannot schedule. The size is not a vibe: it follows from throughput, hold time, and the backend's own connection ceiling.

Method

  1. Size from Little's Law, not intuition. Concurrent connections needed equals throughput times hold time: 500 requests per second each holding a connection for 20ms needs 500 x 0.02 = 10 connections. Add headroom for spikes, but a bigger pool cannot beat the database's core and disk limits.
  2. Cap against the backend's real limit. Postgres max_connections is often 100 to 200, shared across every service and every app instance. Ten app pods at 20 connections each is 200, and the database is full. Sum pools across all clients before setting any one, and put PgBouncer in front when the count outgrows the server.
  3. Set acquisition timeout so waiters fail fast. Configure the pool's connection-wait timeout (HikariCP connectionTimeout, typically a few seconds) so a request that cannot get a connection returns an error instead of hanging forever. A slow acquire should surface as a fast failure, not a thread parked indefinitely.
  4. Bound connection lifetime and validation. Set maxLifetime below the database's and any proxy's idle timeout so the pool retires connections before the server kills them mid-query. Enable a lightweight validation query or keepalive so dead connections are dropped, not handed to a request.
  5. Monitor saturation, not just averages. Track active vs idle connections, connections waiting to acquire, and acquire wait time at p99. The signal of an undersized pool is nonzero and growing wait time, not high average utilization. Alert on sustained waiters.
  6. Separate pools for unlike workloads. Give slow analytics or batch jobs their own smaller pool so a long-running report cannot drain every connection out from under latency-sensitive request traffic.

Signals

  • Does the pool size match throughput times hold time with modest headroom?
  • Does the sum of all client pools stay under the backend's max_connections?
  • Under load, is connection-acquire wait time at p99 near zero?
  • Does maxLifetime sit below every upstream idle and connection timeout?

Boundaries

This sizes and guards the pool. If queries are slow enough that hold time itself is the problem, that is sql-optimization or n-plus-one-queries; a shorter query shrinks the pool you need. Cross-region and serverless connection models add reconnection costs this in-process math does not capture.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 327,069. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.