Skip to content

Commit 3e38d21

Browse files
committed
pm edits for pricing & limits
1 parent 5c9ea0d commit 3e38d21

File tree

6 files changed

+61
-63
lines changed

6 files changed

+61
-63
lines changed

src/content/docs/durable-objects/best-practices/access-durable-objects-storage.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ A Durable Object's [in-memory state](/durable-objects/reference/in-memory-state/
1414

1515
## Access storage
1616

17-
We recommend all new <GlossaryTooltip term="Durable Object class">Durable Object classes</GlossaryTooltip> use the SQLite storage backend. Key-value storage backend remains for backwards compatibility, and a migration path from key-value storage to SQL storage for existing Durable Object classes will be offered in the future.
17+
We recommend all new <GlossaryTooltip term="Durable Object class">Durable Object classes</GlossaryTooltip> use the SQLite storage backend. [Key-value storage backend](/durable-objects/reference/durable-objects-migrations/#create-durable-object-class -with-key-value-storage) remains for backwards compatibility, and a migration path from key-value storage to SQL storage for existing Durable Object classes will be offered in the future.
1818

1919
[Storage API methods](/durable-objects/api/storage-api/#methods) are available on `ctx.storage` parameter passed to the Durable Object constructor. Storage API has SQL APIs and key-value APIs. Only Durable Object classes with a SQLite storage backend can access SQL API.
2020

21-
### Wrangler configuration for SQLite-backed Durable Objects
21+
### Create SQLite-backed Durable Object class
2222

2323
Use `new_sqlite_classes` on the migration in your Worker's Wrangler file:
2424

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

Lines changed: 22 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,28 @@ import { Render, GlossaryTooltip, Details, WranglerConfig } from "~/components";
1010

1111
Durable Objects are a special kind of Worker, so [Workers Limits](/workers/platform/limits/) apply according to your Workers plan. In addition, Durable Objects have specific limits as listed in this page.
1212

13-
- If you exceed any one of these limits, further operations of that type will fail with an error.
14-
- Daily free limits reset at 00:00 UTC.
13+
## SQLite-backed Durable Objects general limits
1514

16-
## SQlite Durable Object general limits
17-
18-
| Feature | Limit for class with SQLite storage backend |
19-
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
20-
| Number of Objects | Unlimited (within an account or of a given class) |
21-
| Maximum Durable Object namespaces | 500 (identical to the [script limit](/workers/platform/limits/)) |
22-
| Storage per class | Unlimited |
23-
| Storage per Durable Object | 10 GB |
24-
| Key size | Key and value combined cannot exceed 2 MB |
25-
| Value size | Key and value combined cannot exceed 2 MB |
26-
| WebSocket message size | 1 MiB (only for received messages) |
27-
| CPU per request | 30 seconds (default) / configurable to 5 minutes of [active CPU time](/workers/platform/limits/#cpu-time) [^1] |
28-
29-
[^1]: Each incoming HTTP request or WebSocket *message* resets the remaining available CPU time to 30 seconds. This allows the Durable Object to consume up to 30 seconds of compute after each incoming network request, with each new network request resetting the timer. If you consume more than 30 seconds of compute between incoming network requests, there is a heightened chance that the individual Durable Object is evicted and reset.
30-
31-
[^2]: Durable Objects both bills and measures storage based on a gigabyte <br/> (1 GB = 1,000,000,000 bytes) and not a gibibyte (GiB). <br/>
15+
| Feature | Limit |
16+
| ---------------------------------------- | ----------------------------------------------------------- |
17+
| Number of Objects | Unlimited (within an account or of a given class) |
18+
| Maximum Durable Object namespaces | 500 (identical to the [script limit](/workers/platform/limits/)) |
19+
| Storage per class | Unlimited |
20+
| Storage per Durable Object | 10 GB [^1] |
21+
| Key size | Key and value combined cannot exceed 2 MB |
22+
| Value size | Key and value combined cannot exceed 2 MB |
23+
| WebSocket message size | 1 MiB (only for received messages) |
24+
| CPU per request | 30 seconds (default) / configurable to 5 minutes of [active CPU time](/workers/platform/limits/#cpu-time) [^2] |
25+
26+
<Details header="Footnotes" open={true}>
27+
1: Durable Objects both bills and measures storage based on a gigabyte <br/> (1 GB = 1,000,000,000 bytes) and not a gibibyte (GiB). <br/>
3228

33-
<Details header="Footnotes">
34-
1: Each incoming HTTP request or WebSocket *message* resets the remaining available CPU time to 30 seconds. This allows the Durable Object to consume up to 30 seconds of compute after each incoming network request, with each new network request resetting the timer. If you consume more than 30 seconds of compute between incoming network requests, there is a heightened chance that the individual Durable Object is evicted and reset.
29+
2: Each incoming HTTP request or WebSocket *message* resets the remaining available CPU time to 30 seconds. This allows the Durable Object to consume up to 30 seconds of compute after each incoming network request, with each new network request resetting the timer. If you consume more than 30 seconds of compute between incoming network requests, there is a heightened chance that the individual Durable Object is evicted and reset. CPU time per request invocation [can be increased](/durable-objects/platform/limits/#increasing-durable-object-cpu-limits).
3530
</Details>
3631

37-
### Increase Durable Object CPU limits
38-
39-
Durable Objects are Worker scripts, and share the same [per invocation CPU limits](/workers/platform/limits/#worker-limits) as any Workers do. Note that CPU time is active processing time: not time spent waiting on network requests, storage calls, or other general I/O, which do not count towards your CPU time or Durable Objects compute consumption.
32+
### SQL storage limits
4033

41-
By default, the maximum CPU time per Durable Objects invocation (HTTP request, WebSocket message, or Alarm) is set to 30 seconds, but can be increased for all Durable Objects associated with a Durable Object definition by setting `limits.cpu_ms` in your Wrangler configuration:
42-
43-
<WranglerConfig>
44-
45-
```jsonc
46-
{
47-
// ...rest of your configuration...
48-
"limits": {
49-
"cpu_ms": 300000, // 300,000 milliseconds = 5 minutes
50-
},
51-
// ...rest of your configuration...
52-
}
53-
```
54-
55-
</WranglerConfig>
56-
57-
58-
## SQL storage limits
59-
60-
For Durable Object classes with [SQLite storage](/durable-objects/api/sql-storage/) backend these SQL limits apply:
34+
For Durable Object classes with [SQLite storage](/durable-objects/api/sql-storage/) these SQL limits apply:
6135

6236
| SQL | Limit |
6337
| -------------------------------------------------------- | ----------------------------------------------- |
@@ -69,26 +43,26 @@ For Durable Object classes with [SQLite storage](/durable-objects/api/sql-storag
6943
| Maximum arguments per SQL function | 32 |
7044
| Maximum characters (bytes) in a `LIKE` or `GLOB` pattern | 50 bytes |
7145

72-
<Render file="do-plans-note"/>
46+
## Key-value backed Durable Objects general limits
7347

74-
## Key-value Durable Object general limits
48+
<Render file="do-plans-note"/>
7549

7650
| Feature | Limit for class with key-value storage backend |
7751
| ---------------------------------------- | ---------------------------------------------------------------- |
7852
| Number of Objects | Unlimited (within an account or of a given class) |
7953
| Maximum Durable Object namespaces | 500 (identical to the [script limit](/workers/platform/limits/)) |
80-
| Storage per account | 50 GB (can be raised by contacting Cloudflare) [^2] |
54+
| Storage per account | 50 GB (can be raised by contacting Cloudflare) [^1] |
8155
| Storage per class | Unlimited |
8256
| Storage per Durable Object | Unlimited |
8357
| Key size | 2 KiB (2048 bytes) |
8458
| Value size | 128 KiB (131072 bytes) |
8559
| WebSocket message size | 1 MiB (only for received messages) |
86-
| CPU per request | 30s (including WebSocket messages) [^1] |
60+
| CPU per request | 30s (including WebSocket messages) [^2] |
8761

8862
<Details header="Footnotes">
8963
1: Durable Objects both bills and measures storage based on a gigabyte <br/> (1 GB = 1,000,000,000 bytes) and not a gibibyte (GiB). <br/>
9064

91-
2: Each incoming HTTP request or WebSocket *message* resets the remaining available CPU time to 30 seconds. This allows the Durable Object to consume up to 30 seconds of compute after each incoming network request, with each new network request resetting the timer. If you consume more than 30 seconds of compute between incoming network requests, there is a heightened chance that the individual Durable Object is evicted and reset.
65+
2: Each incoming HTTP request or WebSocket *message* resets the remaining available CPU time to 30 seconds. This allows the Durable Object to consume up to 30 seconds of compute after each incoming network request, with each new network request resetting the timer. If you consume more than 30 seconds of compute between incoming network requests, there is a heightened chance that the individual Durable Object is evicted and reset. CPU time per request invocation [can be increased](/durable-objects/platform/limits/#increasing-durable-object-cpu-limits).
9266
</Details>
9367

9468
<Render file="limits_increase" product="workers" />

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ sidebar:
77

88
import { Render } from "~/components"
99

10-
<Render file="do-plans-note"/>
11-
1210
Durable Objects can incur two types of billing: compute and storage.
1311

12+
<Render file="do-plans-note"/>
13+
1414
<Render file="durable-objects-pricing" product="durable-objects" params={{product:"durable-objects"}}/>
1515

1616
## Compute billing examples

src/content/docs/durable-objects/reference/durable-objects-migrations.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ new_sqlite_classes = ["DurableObjectAClass"]
7373

7474
</Details>
7575

76+
### Create Durable Object class with key-value storage
77+
78+
We recommend all new <GlossaryTooltip term="Durable Object class">Durable Object classes</GlossaryTooltip> use the SQLite storage backend. Key-value storage backend remains for backwards compatibility.
79+
80+
Use `new_classes` on the migration in your Worker's Wrangler file:
81+
82+
<WranglerConfig>
83+
84+
```toml
85+
[[migrations]]
86+
tag = "v1" # Should be unique for each entry
87+
new_classes = ["MyDurableObject"] # Array of new classes
88+
```
89+
90+
</WranglerConfig>
91+
7692
## Delete migration
7793

7894
Running a Delete migration will delete all Durable Objects associated with the deleted class, including all of their stored data.

src/content/partials/durable-objects/do-plans-note.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
:::note
66
Durable Objects are available both on Workers Free and Workers Paid plans.
77

8-
- **Workers Free plan**: Only Durable Objects with SQLite storage backend are available.
8+
- **Workers Free plan**: Only Durable Objects with [SQLite storage](/durable-objects/best-practices/access-durable-objects-storage/#wrangler-configuration-for-sqlite-backed-durable-objects) are available.
99
- **Workers Paid plan**: Durable Objects with both SQLite storage and key-value storage are available.
1010

11-
If you wish to downgrade from a Workers Paid plan to a Workers Free plan, you must first ensure that you have deleted all namespaces for Durable Objects with key-value storage backend.
11+
If you wish to downgrade from a Workers Paid plan to a Workers Free plan, you must first ensure that you have deleted all Durable Object namespaces with key-value storage backend.
1212
:::

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ import { Markdown, GlossaryTooltip, Details, AnchorHeading } from "~/components"
77
{ props.product === "durable-objects" && <><AnchorHeading title="Compute billing" depth={2}/></> }
88
{ props.product === "workers" && <><AnchorHeading title="Compute billing" depth={3}/></> }
99

10+
On Workers Free plan:
11+
- If you exceed any one of these limits, further operations of that type will fail with an error.
12+
- Daily free limits reset at 00:00 UTC.
13+
1014
Durable Objects are billed only while the Durable Object is active (includes the <GlossaryTooltip term="request context"> request context</GlossaryTooltip>).
1115

1216
| | Free plan | Paid plan |
1317
| -------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
14-
| Requests | Capped at 100,000 per day | 1 million, + $0.15/million<br/> Includes HTTP requests, RPC sessions<sup>1</sup>, WebSocket messages<sup>2</sup>, and alarm invocations |
15-
| Duration<sup>3</sup> | Capped at <br/> 13,000 GB-s per day | 400,000 GB-s, + $12.50/million GB-s<sup>4,5</sup> |
18+
| Requests | 100,000 / day | 1 million, + $0.15/million<br/> Includes HTTP requests, RPC sessions<sup>1</sup>, WebSocket messages<sup>2</sup>, and alarm invocations |
19+
| Duration<sup>3</sup> | 13,000 GB-s / day | 400,000 GB-s, + $12.50/million GB-s<sup>4,5</sup> |
1620

1721
<Details header="Footnotes" open={true}>
1822

@@ -42,26 +46,30 @@ await durableObjectStub.cat(); // billed as a request
4246

4347
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.
4448

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.
49+
- **SQLite-backed Durable Objects (recommended)**: This is the recommended storage for new Durable Object classes. Workers Free plan can only create and access SQLite-backed Durable Objects.
4650
- **Key-value storage backed Durable Objects**: This is only available on the Workers Paid plan.
4751

4852
{ props.product === "durable-objects" && <><AnchorHeading title="SQLite storage backend" depth={3}/></> }
4953
{ props.product === "workers" && <><AnchorHeading title="SQLite storage backend" depth={4}/></> }
5054

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 |
55+
| | Workers Free plan | Workers Paid plan |
56+
| ----------------------------- | ------------------------- | --------------------------------------------------------- |
57+
| Rows reads <sup>1,2</sup> | 5 million / day | First 25 billion / month included + $0.001 / million rows |
58+
| Rows written <sup>1,2,3,4</sup> | 100,000 / day | First 50 million / month included + $1.00 / million rows |
59+
| SQL Stored data <sup>5</sup> | 5 GB (total) | 5 GB-month, + $0.20/ GB-month |
5660

5761
<Details header="Footnotes" open={true}>
5862

59-
<sup>1</sup> Rows read and rows written included limits and rates match D1, Cloudflare's serverless SQL database, [pricing](/d1/platform/pricing/).
63+
<sup>1</sup> Rows read and rows written included limits and rates match [D1 pricing](/d1/platform/pricing/), Cloudflare's serverless SQL database.
6064

6165
<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.
6266

6367
<sup>3</sup> Each `setAlarm` is billed as a single row written.
6468

69+
<sup>4</sup> Deletes are counted as rows_written.
70+
71+
<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.
72+
6573
</Details>
6674

6775
{ props.product === "durable-objects" && <><AnchorHeading title="Key-value storage backend" depth={3}/></> }

0 commit comments

Comments
 (0)