Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Is it the database, or the connection pool?

I build Ritele , so this covers how it handles connection pools. First published on the Ritele blog . When a service slows down, "the database is slow" is an easy first guess. Sometimes it is the database. Sometimes the database is fine, and your service is waiting for a connection from its own pool. From where the user sits, the two look the same: requests take longer, and some time out. This…

When a service experiences slowdown, the first assumption is often that the database is experiencing high load. However, the issue might not be with the database itself, but rather with the connection pool used by the service to communicate with the database. The database could be functioning normally, but the service is waiting for a connection from its pool.

At the user level, both cases appear similar: requests are delayed and may time out. This article explains how a fully utilized connection pool can mimic a slow database, how to differentiate between the two using OpenTelemetry metrics, and how Ritele handles this information. The reason a full connection pool may seem like a slow database is because every service that communicates with Postgres maintains a pool of connections.

When all of these connections are in use, subsequent requests must wait for one to become available. This delay can be mistaken for a slow database call, even if the database itself has available resources. Traces alone cannot distinguish between the two scenarios; the span only indicates that a query took two seconds, but does not provide information on how many connections from the pool were in use or if requests were queued for a connection.

To differentiate, Ritele utilizes OpenTelemetry database-client metrics for connection pools and also supports older db.client.connections.* metrics. These metrics provide valuable information such as the number of connections in use, the number of idle connections, the maximum pool size, pending requests, and the time these requests have been waiting.

The key metric to monitor is requests waiting; a non-zero value indicates that some requests are waiting for a connection rather than for the database itself. Ritele associates each pool with the database it is connected to, using the pool's name as host:port/database. If a pool cannot be linked to a specific database, it is disregarded.

If a pool is associated with multiple databases, Ritele aggregates the data for that shared database across all service callers. The dashboard displays key metrics such as connections held, connections in use, idle connections, and requests waiting, along with the number of callers that contributed to this data. It is important to note that the maximum pool size is not the database's max_connections, but rather the sum of the pool sizes from all services calling the database.

Ritele also includes a health check called DB pool use, which flags the service as Degraded when the pool utilization reaches 85% of its maximum, and Unhealthy at 98% with at least one request waiting. A pool that is 98% utilized but has no waiting requests will remain in the Degraded state. The check is performed over a 5-minute window, requiring three consecutive evaluations within the last five minutes to trigger a status change, and five consecutive evaluations to clear the status.

The health check message provides clear information about the pool's utilization and the number of requests waiting. For example, "Using 9 of 10 database connections; 4 requests waiting." This alert helps identify which pool runs out first during peak usage. It is important to note that the pool pressure alert does not degrade or unhealthy the database itself; it only monitors each service's pool utilization.

The alert is service-specific, and the database's server-side connection metrics are monitored independently. There is no separate alert for waiting times, timeouts, or slow connection creation. Ritele does not infer pool sizes from traces or predict when a pool will run out. Additionally, if multiple pools are reported under different names, they will be counted separately.

The connection pool metrics are opt-in; services must emit these metrics and enable metrics export for Ritele to track them. If a service's database client already emits the necessary metrics, no changes are required. It is crucial to name each pool using the format host:port/database, so Ritele can accurately associate the pool with the correct database. Connection pools are available on all Ritele plans, including the free tier.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

My Journey with Vibe Coding and Building Apps

I'm 56 years old. I come from a technology background, but not in software programming. I've led technology companies, had one for myself until it went bankrupt, and then I shifted gears and went into…

  • At 56, technology professional with no prior coding experience
  • Discovered Vibe Coding in 2025, struggled initially
  • Built first app using PostgreSQL, GitHub, Netlify, Vercel

Defending GeoServer against XML injection beyond the patch

Defending GeoServer against XML injection beyond the patch The direct fix for CVE-2026-120705 is a GeoServer or GeoTools update that restores entity resolver protection in the vulnerable WFS parsing…

  • XML injection flaw in GeoServer's WFS GetFeatureById operation
  • Mitigation includes disabling WFS for anonymous users and restricting access
  • Updated GeoServer versions: 2.27.7, 2.28.6, 3.0.2

A Measurement-First Guide to CSS Performance

A Measurement-First Guide to CSS Performance A stylesheet can be short and still slow a page down. What matters isn’t whether the CSS looks elegant.

  • CSS performance depends on user experience, not just stylesheet elegance
  • Measure page loads using Chrome DevTools, Network panel, and Lighthouse
  • Identify used CSS in recordings to avoid optimizing unused rules

More from Saturday, 28 November 2026 →