You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Durable Objects](/durable-objects/) are only available on the [Workers Paid plan](/workers/platform/pricing/#workers).
7
+
[Durable Objects](/durable-objects/) are only available on the [Workers Paid plan](/workers/platform/pricing/#workers), and are billed while the Durable Object is active (including the <GlossaryTooltipterm="event context"> event context</GlossaryTooltip>).
on a [Durable Objects stub](/durable-objects/) is its own RPC session and
18
-
therefore a single billed request.
14
+
<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/) on a [Durable Objects stub](/durable-objects/) is its own RPC session and therefore a single billed request.
19
15
20
16
RPC method calls can return objects (stubs) extending [`RpcTarget`](/workers/runtime-apis/rpc/lifecycle/#lifetimes-memory-and-resource-management) and invoke calls on those stubs. Subsequent calls on the returned stub are part of the same RPC session and are not billed as separate requests. For example:
21
17
@@ -26,31 +22,13 @@ await foo.baz(); // treated as part of the same RPC session created by calling b
26
22
awaitdurableObjectStub.cat(); // billed as a request
27
23
```
28
24
29
-
<sup>2</sup> A request is needed to create a WebSocket connection. There is no
30
-
charge for outgoing WebSocket messages, nor for incoming [WebSocket protocol
31
-
pings](https://www.rfc-editor.org/rfc/rfc6455#section-5.5.2). For compute
32
-
requests billing-only, a 20:1 ratio is applied to incoming WebSocket messages to
33
-
factor in smaller messages for real-time communication. For example, 100
34
-
WebSocket incoming messages would be charged as 5 requests for billing purposes.
35
-
The 20:1 ratio does not affect Durable Object metrics and analytics, which
36
-
reflect actual usage.
37
-
38
-
<sup>3</sup> Application level auto-response messages handled by
39
-
[`state.setWebSocketAutoResponse()`](/durable-objects/best-practices/websockets/) will not
25
+
<sup>2</sup> A request is needed to create a WebSocket connection. There is no charge for outgoing WebSocket messages, nor for incoming [WebSocket protocol
26
+
pings](https://www.rfc-editor.org/rfc/rfc6455#section-5.5.2). For compute requests billing-only, a 20:1 ratio is applied to incoming WebSocket messages to factor in smaller messages for real-time communication. For example, 100 WebSocket incoming messages would be charged as 5 requests for billing purposes. The 20:1 ratio does not affect Durable Object metrics and analytics, which reflect actual usage.
27
+
28
+
<sup>3</sup> Application level auto-response messages handled by [`state.setWebSocketAutoResponse()`](/durable-objects/best-practices/websockets/) will not
40
29
incur additional wall-clock time, and so they will not be charged.
41
30
42
-
<sup>4</sup> Duration is billed in wall-clock time as long as the Object is
43
-
active, but is shared across all requests active on an Object at once. Once your
44
-
Object finishes responding to all requests, it will stop incurring duration
45
-
charges. Calling `accept()` on a WebSocket in an Object will incur duration
46
-
charges for the entire time the WebSocket is connected. If you prefer, use
instead, which will stop incurring duration charges once all event handlers
49
-
finish running.
50
-
51
-
<sup>5</sup> Duration billing charges for the 128 MB of memory your Durable
52
-
Object is allocated, regardless of actual usage. If your account creates many
53
-
instances of a single Durable Object class, Durable Objects may run in the same
54
-
isolate on the same physical machine and share the 128 MB of memory. These
55
-
Durable Objects are still billed as if they are allocated a full 128 MB of
56
-
memory.
31
+
<sup>4</sup> Duration is billed in wall-clock time as long as the Object is active, but is shared across all requests active on an Object at once. Calling `accept()` on a WebSocket in an Object will incur duration charges for the entire time the WebSocket is connected. If you prefer, use the [WebSocket hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api) to avoid incurring duration charges once all event handlers finish running.
32
+
33
+
<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
34
+
Durable Objects are still billed as if they are allocated a full 128 MB of memory.
0 commit comments