Skip to content
Cloudflare Docs

Tune connection pooling

Hyperdrive maintains a pool of connections to your database that are shared across Worker invocations. You can configure the maximum number of these connections based on your database capacity and application requirements.

Configure connection pool size

You can configure the connection pool size using the Cloudflare dashboard, the Wrangler CLI, or the Cloudflare API.

To configure connection pool size via the dashboard:

  1. Log in to the Cloudflare dashboard and select your account.

  2. Go to Storage & databases > Hyperdrive.

    Go to Hyperdrive
  3. Select your Hyperdrive configuration.

  4. Select Settings.

  5. In the Origin connection limit section, adjust the Maximum connections value.

  6. Select Save.

All Hyperdrive configurations have a minimum of 5 connections. The maximum connection count depends on your Workers plan.

Best practices

  • Start conservatively: Begin with a lower connection count and gradually increase it based on your application's performance.
  • Monitor database metrics: Watch your database's connection usage and performance metrics to optimize the connection count.
  • Consider database limits: Ensure your configured connection count does not exceed your database's maximum connection limit.
  • Account for multiple configurations: If you have multiple Hyperdrive configurations connecting to the same database, consider the total connection count across all configurations.