shiichan

Hyperdrive Now Lets You See Its Connection Pool!

Hey there, it's Shii-chan! Today's update is a little low-key, but if you use Hyperdrive it's a really nice observability win, so let me walk you through it.

Cloudflare Changelog developers.cloudflare.com

What was announced?

From the Cloudflare Changelog. Hyperdrive now lets you view your database connection pool size as metrics.

Here are the four you get:

  • waitingClients - requests queued waiting for an available connection
  • currentPoolSize - connections currently open to the database
  • availablePoolSlots - unused connection capacity
  • maxPoolSize - the configured connection limit

The story so far

Until now, when your database got congested, the "why is this slow?" part was hard to see. Whether connections were exhausted and clients were queuing up, or there was still plenty of room, wasn't easy to tell from the outside.

What changes

Now that the pool state shows up as numbers, isolating bottlenecks gets much easier. If waitingClients spikes while currentPoolSize is pinned at maxPoolSize, you can immediately tell you're out of connections. And if you're hitting the ceiling, it's easier to decide whether to request a limit increase.

Dive Deep

There are two ways to see this.

One is the dashboard. Each Hyperdrive configuration's Metrics tab gets a new "Pool connections" chart that shows waiting clients and open connections against your configured maximum, and you can filter by airport code location.

The other is the GraphQL Analytics API. The hyperdrivePoolSizesAdaptiveGroups dataset gives you average and peak values for those metrics. If you want to wire it into your own dashboards, this is the handy path. For details, check the metrics documentation.

Wrap-up

  • Hyperdrive now exposes connection pool size metrics
  • You get waitingClients / currentPoolSize / availablePoolSlots / maxPoolSize
  • View them via the dashboard "Pool connections" chart or the GraphQL hyperdrivePoolSizesAdaptiveGroups dataset
  • It makes diagnosing connection contention and limit-hitting much easier

This one's for anyone connecting to a DB through Hyperdrive from Workers who's been puzzled by the occasional mystery slowdown!