Skip to content

Commit b189b19

Browse files
committed
Consolidating DO pricing into one page, using
conditional rendering to ensure it fits everywhere
1 parent 8251c49 commit b189b19

File tree

4 files changed

+65
-74
lines changed

4 files changed

+65
-74
lines changed

src/content/docs/durable-objects/platform/pricing.mdx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@ pcx_content_type: concept
33
title: Pricing
44
sidebar:
55
order: 1
6-
76
---
87

98
import { Render } from "~/components"
109

1110
Durable Objects can incur two types of billing: compute and storage.
1211

13-
## Compute billing
14-
15-
<Render file="durable-objects-pricing" product="durable-objects" />
12+
<Render file="durable-objects-pricing" product="durable-objects" params={{product:"durable-objects"}}/>
1613

17-
### Compute billing examples
14+
## Compute billing examples
1815

1916
These examples exclude the costs for the Workers calling the Durable Objects. When modelling the costs of a Durable Object, note that:
2017

2118
* Inactive objects receiving no requests do not incur any duration charges.
22-
* The [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api) can dramatically reduce duration-related charges for Durable Objects communicating with clients over the WebSocket protocol, especially if messages are only transmitted occasionally at sparse intervals.
19+
* The [WebSocket Hibernation API](/durable-objects/best-practices/websockets#websocket-hibernation-api) can dramatically reduce duration-related charges for Durable Objects communicating with clients over the WebSocket protocol, especially if messages are only transmitted occasionally at sparse intervals.
2320

2421
#### Example 1
2522

@@ -117,10 +114,6 @@ In this scenario, the estimated monthly cost would be calculated as:
117114

118115
<sup>2</sup> The example uses 1 second because each Durable Object is active for 1 second per minute. This can also be thought of as 432 million requests that each take 10 ms to execute (4,320,000 seconds).
119116

120-
## Storage API billing
121-
122-
<Render file="do-storage-api-pricing" product="durable-objects" />
123-
124117
## Frequently Asked Questions
125118

126119
### Does an empty table / SQLite database contribute to my storage?
@@ -131,4 +124,4 @@ Yes, although minimal. Empty tables can consume at least a few kilobytes, based
131124

132125
All writes to a SQLite-backed Durable Object stores nominal amounts of metadata in internal tables in the Durable Object, which counts towards your billable storage.
133126

134-
The metadata remains in the Durable Object until you call [`deleteAll()`](/durable-objects/api/storage-api/#deleteall).
127+
The metadata remains in the Durable Object until you call [`deleteAll()`](/durable-objects/api/storage-api#deleteall).

src/content/docs/workers/platform/pricing.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,18 @@ Refer to [D1 Pricing](/d1/platform/pricing/) to learn more about how D1 is bille
172172

173173
:::
174174

175-
## Durable Objects Compute
175+
## Durable Objects
176176

177-
Durable Objects are available on both the Workers Free and Workers Paid plans.
177+
Durable Objects are available on both the Workers Free and Workers Paid plans, and are billed based on the compute and storage.
178178

179-
<Render file="durable-objects-pricing" product="durable-objects" />
179+
<Render file="durable-objects-pricing" product="durable-objects" params={{product:"workers"}} />
180180

181181
:::note[Durable Objects billing examples]
182182

183-
For more information and [examples of Durable Objects billing](/durable-objects/platform/pricing/#durable-objects-billing-examples), refer to [Durable Objects Pricing](/durable-objects/platform/pricing/).
183+
For more information and [examples of Durable Objects billing](/durable-objects/platform/pricing#compute-billing-examples), refer to [Durable Objects Pricing](/durable-objects/platform/pricing/).
184184

185185
:::
186186

187-
## Durable Objects Storage API
188-
189-
<Render file="do-storage-api_pricing" product="durable-objects" />
190-
191187
## Vectorize
192188

193189
Vectorize is currently only available on the Workers paid plan.

src/content/partials/durable-objects/do-storage-api-pricing.mdx

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/content/partials/durable-objects/durable-objects-pricing.mdx

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
{}
33
---
44

5-
import { Markdown, GlossaryTooltip, Details } from "~/components";
5+
import { Markdown, GlossaryTooltip, Details, AnchorHeading } from "~/components";
6+
7+
{ props.product === "durable-objects" && <><AnchorHeading title="Compute billing" depth={2}/></> }
8+
{ props.product === "workers" && <><AnchorHeading title="Compute billing" depth={3}/></> }
69

710
Durable Objects are billed only while the Durable Object is active (includes the <GlossaryTooltip term="request context"> request context</GlossaryTooltip>).
811

@@ -32,4 +35,57 @@ await durableObjectStub.cat(); // billed as a request
3235

3336
<sup>5</sup> Duration billing charges for the 128 MB of memory your Durable Object is allocated, regardless of actual usage. If your account creates many instances of a single Durable Object class, Durable Objects may run in the same isolate on the same physical machine and share the 128 MB of memory. These Durable Objects are still billed as if they are allocated a full 128 MB of memory.
3437

38+
</Details>
39+
40+
{ props.product === "durable-objects" && <><AnchorHeading title="Storage billing" depth={2}/></> }
41+
{ props.product === "workers" && <><AnchorHeading title="Storage billing" depth={3}/></> }
42+
43+
The [Durable Objects Storage API](/durable-objects/api/storage-api) is only accessible from within Durable Objects. Pricing depends on the type of storage your Durable Objects use.
44+
45+
- **SQLite-storage backed Durable Objects (recommended)**: This is the default storage used by Durable Objects. You can use SQLite-storage backed Durable Objects without a Workers Paid plan, or unlock higher limits with a Workers paid plan.
46+
- **Key-value storage backed Durable Objects**: This is only available on the Workers Paid plan.
47+
48+
{ props.product === "durable-objects" && <><AnchorHeading title="SQLite storage backend" depth={3}/></> }
49+
{ props.product === "workers" && <><AnchorHeading title="SQLite storage backend" depth={4}/></> }
50+
51+
| | Workers Free plan | Workers Paid plan |
52+
| ----------------------------| ------------------------- | --------------------------------------------------------- |
53+
| Rows reads <sup>1,2</sup> | Capped at 5 million / day | First 25 billion / month included + $0.001 / million rows |
54+
| Rows written <sup>1,2</sup> | Capped at 100,000 / day | First 50 million / month included + $1.00 / million rows |
55+
| SQL Stored data | 5 GB (total) | 5 GB-month, + $0.20/ GB-month |
56+
57+
<Details header="Footnotes" open={true}>
58+
59+
<sup>1</sup> Rows read and rows written included limits and rates match D1, Cloudflare's serverless SQL database, [pricing](/d1/platform/pricing/).
60+
61+
<sup>2</sup> Key-value methods like `get()`, `put()`, `delete()`, or `list()` store and query data in a hidden SQLite table and are billed as rows read and rows written.
62+
63+
<sup>3</sup> Each `setAlarm` is billed as a single row written.
64+
65+
</Details>
66+
67+
{ props.product === "durable-objects" && <><AnchorHeading title="Key-value storage backend" depth={3}/></> }
68+
{ props.product === "workers" && <><AnchorHeading title="Key-value storage backend" depth={4}/></> }
69+
70+
| | Workers Paid plan |
71+
| -------------------------------- | -------------------------- |
72+
| Read request units<sup>1,2</sup> | 1 million, + $0.20/million |
73+
| Write request units<sup>3</sup> | 1 million, + $1.00/million |
74+
| Delete requests<sup>4</sup> | 1 million, + $1.00/million |
75+
| Stored data<sup>5</sup> | 1 GB, + $0.20/ GB-month |
76+
77+
<Details header="Footnotes" open={true}>
78+
79+
<sup>1</sup> A request unit is defined as 4 KB of data read or written. A request that writes or reads more than 4 KB will consume multiple units, for example, a 9 KB write will consume 3 write request units.
80+
81+
<sup>2</sup> List operations are billed by read request units, based on the amount of data examined. For example, a list request that returns a combined 80 KB of keys and values will be billed 20 read request units. A list request that does not return anything is billed for 1 read request unit.
82+
83+
<sup>3</sup> Each `setAlarm` is billed as a single write request unit.
84+
85+
<sup>4</sup> Delete requests are unmetered. For example, deleting a 100 KB value will be charged one delete request.
86+
87+
<sup>5</sup> Durable Objects will be billed for stored data until the data is removed. Once the data is removed, the object will be cleaned up automatically by the system.
88+
89+
Requests that hit the [Durable Objects in-memory cache](/durable-objects/reference/in-memory-state/) or that use the [multi-key versions of `get()`/`put()`/`delete()` methods](/durable-objects/api/storage-api/) are billed the same as if they were a normal, individual request for each key.
90+
3591
</Details>

0 commit comments

Comments
 (0)