Skip to content

Commit 46ee756

Browse files
authored
[Hyperdrive] Configurable connection count (#23332)
* [Hyperdrive] Configurable connection count * Update src/content/docs/hyperdrive/configuration/connection-pooling.mdx * Update src/content/docs/hyperdrive/configuration/connection-pooling.mdx * Update src/content/docs/hyperdrive/configuration/connection-pooling.mdx * Remove wrangler commands from Hyperdrive configurable connections count
1 parent 6318fea commit 46ee756

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Hyperdrive now supports configuring the amount of database connections
3+
description: Hyperdrive configurations can now be set to use a specific number of connections to your origin database.
4+
products:
5+
- hyperdrive
6+
date: 2025-07-03T18:00:00Z
7+
---
8+
9+
You can now specify the number of connections your Hyperdrive configuration uses to connect to your origin database.
10+
11+
All configurations have a minimum of 5 connections. The maximum connection count for a Hyperdrive configuration depends on the [Hyperdrive limits of your Workers plan](/hyperdrive/platform/limits/).
12+
13+
This feature allows you to right-size your connection pool based on your database capacity and application requirements. You can configure connection counts through the Cloudflare dashboard or API.
14+
15+
Refer to the [Hyperdrive configuration documentation](/hyperdrive/configuration/connection-pooling/) for more information.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
pcx_content_type: concept
3+
title: Connection pooling
4+
sidebar:
5+
order: 5
6+
---
7+
8+
Hyperdrive maintains a pool of connections to your database. These are optimally placed to minimize the latency for your applications. You can configure
9+
the amount of connections your Hyperdrive configuration uses to connect to your origin database. This enables you to right-size your connection pool based on your database capacity and application requirements.
10+
11+
For instance, if your Worker makes many queries to your database (which cannot be resolved by Hyperdrive's caching), you may want to allow Hyperdrive to make more connections to your database.
12+
Conversely, if your Worker makes few queries that actually need to reach your database or if your database allows a small number of database connections, you can reduce the amount of connections Hyperdrive will make to your database.
13+
14+
All configurations have a minimum of 5 connections, and with a maximum depending on your Workers plan. Refer to the [limits](/hyperdrive/platform/limits/) for details.
15+
16+
## How Hyperdrive pools database connections
17+
18+
Hyperdrive will automatically scale the amount of database connections held open by Hyperdrive depending on your traffic and the amount of load that is put on your database.
19+
20+
The `max_size` parameter acts as a soft limit - Hyperdrive may temporarily create additional connections during network issues or high traffic periods to ensure high availability and resiliency.
21+
22+
## Best practices
23+
24+
You can configure connection counts using the Cloudflare dashboard or the Cloudflare API. Consider the following best practices to determine the right limit for your use-case:
25+
26+
- **Start conservatively**: Begin with a lower connection count and increase as needed based on your application's performance.
27+
- **Monitor database metrics**: Watch your database's connection usage and performance metrics to optimize the connection count.
28+
- **Consider database limits**: Ensure your configured connection count doesn't exceed your database's maximum connection limit.
29+
- **Account for multiple configurations**: If you have multiple Hyperdrive configurations connecting to the same database, consider the total connection count across all configurations.
30+
31+
## Next steps
32+
33+
- Learn more about [How Hyperdrive works](/hyperdrive/configuration/how-hyperdrive-works/).
34+
- Review [Hyperdrive limits](/hyperdrive/platform/limits/) for your Workers plan.
35+
- Learn how to [Connect to PostgreSQL](/hyperdrive/examples/connect-to-postgres/) from Hyperdrive.

src/content/release-notes/hyperdrive.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ productLink: "/hyperdrive/"
55
productArea: Developer platform
66
productAreaLink: /workers/platform/changelog/platform/
77
entries:
8+
- publish_date: "2025-07-03"
9+
title: Hyperdrive now supports configurable connection counts
10+
description: |-
11+
Hyperdrive configurations can now be set to use a specific number of connections to your origin database. There is a minimum of 5 connections for all configurations and a maximum according to your [Workers plan](/hyperdrive/platform/limits/).
12+
13+
This limit is a soft maximum. Hyperdrive may make more than this amount of connections in the event of unexpected networking issues in order to ensure high availability and resiliency.
814
- publish_date: "2025-05-05"
915
title: Hyperdrive improves regional caching for prepared statements for faster cache hits
1016
description: |-

0 commit comments

Comments
 (0)