Skip to content

Commit 1e0890d

Browse files
committed
hyperdrive: add placement guidance
1 parent edbcc94 commit 1e0890d

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

src/content/docs/hyperdrive/concepts/how-hyperdrive-works.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Hyperdrive automatically manages the connection pool properties for you, includi
5151

5252
Learn more about connection pooling behavior and configuration in [Connection pooling](/hyperdrive/concepts/connection-pooling/).
5353

54+
<Render file="placement-hint-partial" product="hyperdrive" />
55+
5456
### 3. Query Caching
5557

5658
Hyperdrive supports caching of non-mutating (read) queries to your database.

src/content/docs/hyperdrive/get-started.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ For example, if the URL of your new Worker is `hyperdrive-tutorial.<YOUR_SUBDOMA
402402

403403
By finishing this tutorial, you have created a Hyperdrive configuration, a Worker to access that database and deployed your project globally.
404404

405+
<Render file="placement-hint-partial" product="hyperdrive" />
406+
405407
## Next steps
406408

407409
- Learn more about [how Hyperdrive works](/hyperdrive/concepts/how-hyperdrive-works/).

src/content/docs/hyperdrive/reference/faq.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ and how Hyperdrive solves this.
2727

2828
D1 does not require round trips to create database connections. D1 is designed to be performant for access from Workers by default, without needing Hyperdrive.
2929

30+
### Should I use Placement with Hyperdrive?
31+
32+
Yes, if your Worker makes multiple queries per request. [Placement](/workers/configuration/placement/) runs your Worker near your database, reducing per-query latency from 20-30ms to 1-3ms. Hyperdrive handles connection pooling and setup. Placement reduces the network distance for query execution.
33+
34+
Use `placement.region` if your database runs in AWS, GCP, or Azure. Use `placement.host` for databases hosted elsewhere.
35+
3036
## Pricing
3137

3238
### Does Hyperdrive charge for data transfer / egress?
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
{}
3+
---
4+
5+
:::note[Reduce latency with Placement]
6+
7+
If your Worker makes **multiple sequential queries** per request, use [Placement](/workers/configuration/placement/) to run your Worker close to your database. Each query adds round-trip latency: 20-30ms from a distant region, or 1-3ms when placed nearby. Multiple queries compound this difference.
8+
9+
If your Worker makes only one query per request, placement does not improve end-to-end latency. The total round-trip time is the same whether it happens near the user or near the database.
10+
11+
```jsonc title="wrangler.jsonc"
12+
{
13+
"placement": {
14+
"region": "aws:us-east-1", // Match your database region, for example "gcp:us-east4" or "azure:eastus"
15+
},
16+
}
17+
```
18+
19+
:::

0 commit comments

Comments
 (0)