Skip to content

Commit

Permalink
[Chore] Workers pricing partials (#16106)
Browse files Browse the repository at this point in the history
* [Chore] Workers pricing partials

* Add another file and remove table-wrap
  • Loading branch information
kodster28 authored Aug 13, 2024
1 parent 20e9277 commit 66b25ea
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 58 deletions.
58 changes: 27 additions & 31 deletions src/content/partials/durable-objects/durable-objects-pricing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Durable Objects are only available on the [Workers Paid plan](/workers/platform/
| | Paid plan |
| -------------------- | ------------------------------------------------- |
| Requests<sup>1</sup> | 1 million, + $0.15/million |
| Duration<sup>2</sup> | 400,000 GB-s, + {props.one}2.50/million GB-s<sup>3,4</sup> |
| Duration<sup>2</sup> | 400,000 GB-s, + $12.50/million GB-s<sup>3,4</sup> |



Expand All @@ -34,57 +34,53 @@ These examples exclude the costs for the Workers calling the Durable Objects.

If a single Durable Object was called by a Worker 1.5 million times, and was active for 1,000,000 seconds in the month, the estimated cost in a month would be:

Total = \~$0.08 USD + Minimum {props.five}/mo usage = {props.five}.08
Total = ~$0.08 USD + Minimum $5/mo usage = $5.08

* (1.5 million requests - included 1 million requests) x $0.15 / 1,000,000 = $0.075
* 1,000,000 seconds \* 128 MB / 1 GB = 128,000 GB-s
* (128,000 GB-s - included 400,000 GB-s) x {props.one}2.50 / 1,000,000 = $0.00
- (1.5 million requests - included 1 million requests) x $0.15 / 1,000,000 = $0.075
- 1,000,000 seconds \* 128 MB / 1 GB = 128,000 GB-s
- (128,000 GB-s - included 400,000 GB-s) x $12.50 / 1,000,000 = $0.00

#### Example 2

If 100 Durable Objects each had 100 WebSocket connections established to each of them which sent approximately one message a minute for a month, the estimated cost in a month would be, if the messages overlapped so that the Objects were actually active for half the month:

Total = \~{props.six}4.65 USD + {props.two}02.36 USD + Minimum {props.five}/mo usage = {props.two}72.01
Total = ~$64.65 USD + $202.36 USD + Minimum $5/mo usage = $272.01

* 100 requests to establish the WebSockets.
* 100 messages per minute \* 100 Durable Objects \* 60 minutes \* 24 hours \* 30 days = 432,000,000 requests
* (432 million requests - included 1 million requests) x $0.15 / 1,000,000 = {props.six}4.65
* 100 Durable Objects \* 60 seconds \* 60 minutes \* 24 hours \* 30 days / 2 = 129,600,000 seconds
* 129,600,000 seconds \* 128 MB / 1 GB = 16,588,800 GB-s
* (16,588,800 GB-s - included 400,000 GB-s) x {props.one}2.50 / 1,000,000 = {props.two}02.36
- 100 requests to establish the WebSockets.
- 100 messages per minute \* 100 Durable Objects \* 60 minutes \* 24 hours \* 30 days = 432,000,000 requests
- (432 million requests - included 1 million requests) x $0.15 / 1,000,000 = $64.65
- 100 Durable Objects \* 60 seconds \* 60 minutes \* 24 hours \* 30 days / 2 = 129,600,000 seconds
- 129,600,000 seconds \* 128 MB / 1 GB = 16,588,800 GB-s
- (16,588,800 GB-s - included 400,000 GB-s) x $12.50 / 1,000,000 = $202.36

#### Example 3

If 100 Durable Objects each had a single WebSocket connection established to each of them, which sent one message a second for a month, and the messages overlapped so that the Objects were actually active for the entire month, the estimated cost in a month would be:

Total = \~{props.three}8.73 USD + {props.four}09.72 USD + Minimum {props.five}/mo usage = {props.four}53.45
Total = ~$38.73 USD + $409.72 USD + Minimum $5/mo usage = $453.45

* 100 requests to establish the WebSockets.
* 1 message per second \* 100 connections \* 60 seconds \* 60 minutes \* 24 hours \* 30 days = 259,200,000 requests
* (259.2 million requests - included 1 million requests) x $0.15 / 1,000,000 = {props.three}8.73
* 100 Durable Objects \* 60 seconds \* 60 minutes \* 24 hours \* 30 days = 259,200,000 seconds
* 259,200,000 seconds \* 128 MB / 1 GB = 33,177,600 GB-s
* (33,177,600 GB-s - included 400,000 GB-s) x {props.one}2.50 / 1,000,000 = {props.four}09.72
- 100 requests to establish the WebSockets.
- 1 message per second \* 100 connections \* 60 seconds \* 60 minutes \* 24 hours \* 30 days = 259,200,000 requests
- (259.2 million requests - included 1 million requests) x $0.15 / 1,000,000 = $38.73
- 100 Durable Objects \* 60 seconds \* 60 minutes \* 24 hours \* 30 days = 259,200,000 seconds
- 259,200,000 seconds \* 128 MB / 1 GB = 33,177,600 GB-s
- (33,177,600 GB-s - included 400,000 GB-s) x $12.50 / 1,000,000 = $409.72

## Transactional Storage API

The [Transactional Storage API](/durable-objects/api/transactional-storage-api/) is only accessible from within Durable Objects. Durable Objects do not have to use the Transactional Storage API, but if your code does call methods on `state.storage`, it will incur the following additional charges:



| | Paid plan |
| -------------------------------- | -------------------------- |
| Read request units<sup>1,2</sup> | 1 million, + $0.20/million |
| Write request units<sup>1</sup> | 1 million, + {props.one}.00/million |
| Delete requests<sup>3</sup> | 1 million, + {props.one}.00/million |
| Write request units<sup>1</sup> | 1 million, + $1.00/million |
| Delete requests<sup>3</sup> | 1 million, + $1.00/million |
| Stored data<sup>4</sup> | 1 GB, + $0.20/ GB-month |

1. 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 three write request units.
2. 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 one read request unit.
3. Delete requests are unmetered. For example, deleting a 100 KB value will be charged one delete request.
4. 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.
5. Each alarm write is billed as a single write request unit.


1. 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 three write request units.
2. 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 one read request unit.
3. Delete requests are unmetered. For example, deleting a 100 KB value will be charged one delete request.
4. 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.
5. Each alarm write is billed as a single write request unit.

Requests that hit the Durable Objects in-memory cache or that use the [multi-key versions of `get()`/`put()`/`delete()` methods](/durable-objects/api/transactional-storage-api/) are billed the same as if they were a normal, individual request for each key.
Requests that hit the Durable Objects in-memory cache or that use the [multi-key versions of `get()`/`put()`/`delete()` methods](/durable-objects/api/transactional-storage-api/) are billed the same as if they were a normal, individual request for each key.
14 changes: 7 additions & 7 deletions src/content/partials/workers/d1-pricing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

---

import { Markdown } from "~/components"
| | [Workers Free](/workers/platform/pricing/#workers) | [Workers Paid](/workers/platform/pricing/#workers) |
| ------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------ |
| Rows read | 5 million / day | First 25 billion / month included + $0.001 / million rows |
| Rows written | 100,000 / day | First 50 million / month included + $1.00 / million rows |
| Storage (per GB stored) | 5 GB (total) | First 5 GB included + $0.75 / GB-mo |

| | [Workers Free](/workers/platform/pricing/#workers) | [Workers Paid](/workers/platform/pricing/#workers) |
| ----------------------- | -------------------------------------------------- | ---------------------------------------------------------- |
| Rows read | 5 million / day | First 25 billion / month included + $0.001 / million rows |
| Rows written | 100,000 / day | First 50 million / month included + {props.one}.00 / million rows |
| Storage (per GB stored) | 5 GB (total) | First 5 GB included + $0.75 / GB-mo |

### Definitions

### Definitions
1. Rows read measure how many rows a query reads (scans), regardless of the size of each row. For example, if you have a table with 5000 rows and run a `SELECT * FROM table` as a full table scan, this would count as 5,000 rows read. A query that filters on an [unindexed column](/d1/build-with-d1/use-indexes/) may return fewer rows to your Worker, but is still required to read (scan) more rows to determine which subset to return.
2. Rows written measure how many rows were written to D1 database. A query that `INSERT` 10 rows into a `users` table would count as 10 rows written.
3. Row size or the number of columns in a row does not impact how rows are counted. A row that is 1 KB and a row that is 100 KB both count as one row.
Expand All @@ -21,3 +20,4 @@ import { Markdown } from "~/components"
6. Storage is based on gigabytes stored per month, and is based on the sum of all databases in your account. Tables and indexes both count towards storage consumed.
7. Free limits reset daily at 00:00 UTC. Monthly included limits reset based on your monthly subscription renewal date, which is determined by the day you first subscribed.
8. There are no data transfer (egress) or throughput (bandwidth) charges for data accessed from D1.
8. There are no data transfer (egress) or throughput (bandwidth) charges for data accessed from D1.
8 changes: 4 additions & 4 deletions src/content/partials/workers/durable_objects_pricing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { Markdown } from "~/components"

[Durable Objects](/durable-objects/) are only available on the [Workers Paid plan](/workers/platform/pricing/#workers).

| | Paid plan |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Requests | 1 million, + $0.15/million<br/> Includes HTTP requests, RPC sessions<sup>1</sup>, WebSocket messages<sup>2</sup>, and alarm invocations |
| Duration<sup>3</sup> | 400,000 GB-s, + {props.one}2.50/million GB-s<sup>4,5</sup> |
| | Paid plan |
| -------- | ------------------------------------------------- |
| Requests | 1 million, + $0.15/million<br/> Includes HTTP requests, RPC sessions<sup>1</sup>, WebSocket messages<sup>2</sup>, and alarm invocations |
| Duration<sup>3</sup> | 400,000 GB-s, + $12.50/million GB-s<sup>4,5</sup> |

<sup>1</sup> Each [RPC session](/workers/runtime-apis/rpc/lifecycle/) is billed as one request to your Durable Object. Every [RPC method call](/durable-objects/best-practices/create-durable-object-stubs-and-send-requests/#call-rpc-methods) on a [Durable Objects stub](/durable-objects/best-practices/create-durable-object-stubs-and-send-requests/#get-a-durable-object-stub) is its own RPC session and therefore a single billed request.

Expand Down
8 changes: 4 additions & 4 deletions src/content/partials/workers/kv_pricing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Workers KV is included in both the Free and Paid [Workers plans](/workers/platfo
| | Free plan<sup>1</sup> | Paid plan |
| --------------- | --------------------- | --------------------------------- |
| Read requests | 100,000 / day | 10 million/month, + $0.50/million |
| Write requests | 1,000 / day | 1 million/month, + {props.five}.00/million |
| Delete requests | 1,000 / day | 1 million/month, + {props.five}.00/million |
| List requests | 1,000 / day | 1 million/month, + {props.five}.00/million |
| Write requests | 1,000 / day | 1 million/month, + $5.00/million |
| Delete requests | 1,000 / day | 1 million/month, + $5.00/million |
| List requests | 1,000 / day | 1 million/month, + $5.00/million |
| Stored data | 1 GB | 1 GB, + $0.50/ GB-month |

<sup>1</sup> The Workers Free plan includes limited Workers KV usage. All limits reset daily at 00:00 UTC. If you exceed any one of these limits, further operations of that type will fail with an error.
<sup>1</sup> The Workers Free plan includes limited Workers KV usage. All limits reset daily at 00:00 UTC. If you exceed any one of these limits, further operations of that type will fail with an error.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@

---

import { Markdown } from "~/components"

The Durable Objects [Transactional Storage API](/durable-objects/api/transactional-storage-api) is only accessible from within Durable Objects.

Durable Objects do not have to use the Transactional Storage API, but if your code does call methods on `state.storage`, it will incur the following additional charges:

| | Paid plan |
| -------------------------------- | -------------------------- |
| Read request units<sup>1,2</sup> | 1 million, + $0.20/million |
| Write request units<sup>3</sup> | 1 million, + {props.one}.00/million |
| Delete requests<sup>4</sup> | 1 million, + {props.one}.00/million |
| Write request units<sup>3</sup> | 1 million, + $1.00/million |
| Delete requests<sup>4</sup> | 1 million, + $1.00/million |
| Stored data<sup>5</sup> | 1 GB, + $0.20/ GB-month |

<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.
Expand Down
13 changes: 5 additions & 8 deletions src/content/partials/workers/vectorize-pricing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@

---

import { Markdown } from "~/components"

| | [Workers Paid](/workers/platform/pricing/#workers) | [Workers Free](/workers/platform/pricing/#workers) <sup>1</sup> |
| ----------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| **Total queried vector dimensions** | First 50 million queried vector dimensions / month included + $0.040 per million | 30 million queried vector dimensions / month |
| **Total stored vector dimensions** | First 10 million stored vector dimensions + $0.040 per million | 5 million stored vector dimensions |
| | [Workers Paid](/workers/platform/pricing/#workers) | [Workers Free](/workers/platform/pricing/#workers) <sup>1</sup> |
| ------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
| **Total queried vector dimensions** | First 50 million queried vector dimensions / month included + $0.040 per million | 30 million queried vector dimensions / month |
| **Total stored vector dimensions** | First 10 million stored vector dimensions + $0.040 per million | 5 million stored vector dimensions |

<sup>1</sup> Vectorize will be available to developers on the Workers Free plan in the future.

### Calculating vector dimensions

To calculate your potential usage, calculate the sum of your stored + queried vectors, multiply by the dimension size, and multiply by the unit price (divided by 1 million). The formula is defined as `(stored vectors + queried vectors) * dimensions * ($0.040 / 1000000)`

* For example, inserting 10,000 vectors of 768 dimensions each, and querying those 1,000 times per day (30,000 times per month) would be calculated as `(30000 * 768) = 23,040,000` queried dimensions and `(10000 * 768) = 7,680,000` stored dimensions (within the included monthly allocation)
* Separately, and excluding the included monthly allocation, this would be calculated as `(30,000+10,000) * 768 * ($0.040 / 1,000,000)` and sum to {props.one}.23 per month.
* Separately, and excluding the included monthly allocation, this would be calculated as `(30,000+10,000) * 768 * ($0.040 / 1,000,000)` and sum to $1.23 per month.

0 comments on commit 66b25ea

Please sign in to comment.