コンテンツにスキップ

価格設定

請求メトリクス

Durable Objects are only available on the Workers Paid plan.

Paid plan
Requests1 million, + $0.15/million
Includes HTTP requests, RPC sessions1, WebSocket messages2, and alarm invocations
Duration3400,000 GB-s, + $12.50/million GB-s4,5

1 Each RPC session is billed as one request to your Durable Object. Every RPC method call on a Durable Objects stub is its own RPC session and therefore a single billed request.

RPC method calls can return objects (stubs) extending RpcTarget 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:

let durableObjectStub = OBJECT_NAMESPACE.get(id); // retrieve Durable Object stub
using foo = await durableObjectStub.bar(); // billed as a request
await foo.baz(); // treated as part of the same RPC session created by calling bar(), not billed as a request
await durableObjectStub.cat(); // billed as a request

2 A request is needed to create a WebSocket connection. There is no charge for outgoing WebSocket messages, nor for incoming WebSocket protocol pings. 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.

3 Application level auto-response messages handled by state.setWebSocketAutoResponse() will not incur additional wall-clock time, and so they will not be charged.

4 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. Once your Object finishes responding to all requests, it will stop incurring duration charges. Calling accept() on a WebSocket in an Object will incur duration charges for the entire time the WebSocket is connected. If you prefer, use state.acceptWebSocket() instead, which will stop incurring duration charges once all event handlers finish running.

5 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.

耐久オブジェクトの請求例

これらの例は、耐久オブジェクトを呼び出すワーカーのコストを除外しています。耐久オブジェクトのコストをモデル化する際には、以下に注意してください:

  • リクエストを受け取らない非アクティブなオブジェクトは、期間料金が発生しません。
  • WebSocket休眠APIは、WebSocketプロトコルを介してクライアントと通信する耐久オブジェクトの期間関連の料金を大幅に削減できます。特に、メッセージがまれにしか送信されない場合に効果的です。

例1

この例は、HTTPを介して呼び出される調整サービスとして使用されるシンプルな耐久オブジェクトを表しています。

  • 1つの耐久オブジェクトがワーカーによって150万回呼び出されました。
  • 月間で1,000,000秒アクティブです。

このシナリオでは、推定月額コストは以下のように計算されます:

リクエスト:

  • (150万リクエスト - 含まれている100万リクエスト) x $0.15 / 1,000,000 = $0.075

計算期間:

  • 1,000,000秒 * 128 MB / 1 GB = 128,000 GB-s
  • (128,000 GB-s - 含まれている400,000 GB-s) x $12.50 / 1,000,000 = $0.00

推定合計: ~$0.075 (リクエスト) + $0.00 (計算期間) + 最低$5/月の使用料 = $5.08 per month

例2

この例は、WebSocketを使用してゲーム、チャット、またはリアルタイムのユーザー状態を接続されたクライアント間でブロードキャストする中程度のトラフィックの耐久オブジェクトベースのアプリケーションを表しています:

  • 100の耐久オブジェクトがそれぞれに50のWebSocket接続を確立しています。
  • クライアントは、毎日8時間、毎分約1メッセージを送信します。

このシナリオでは、推定月額コストは以下のように計算されます:

リクエスト:

  • 50のWebSocket接続 * 100の耐久オブジェクトでWebSocketを確立 = 毎日5,000接続が作成される * 30日 = 150,000 WebSocket接続リクエスト。
  • 50メッセージ/分 * 100の耐久オブジェクト * 60分 * 8時間 * 30日 = 72,000,000 WebSocketメッセージリクエスト。
  • 150,000 + (7200万リクエスト / 20のWebSocketメッセージ請求比率) = 3.75百万請求リクエスト。
  • (3.75百万リクエスト - 含まれている100万リクエスト) x $0.15 / 1,000,000 = $0.41。

計算期間:

  • 100の耐久オブジェクト * 60秒 * 60分 * 8時間 * 30日 = 86,400,000秒。
  • 86,400,000秒 * 128 MB / 1 GB = 11,059,200 GB-s。
  • (11,059,200 GB-s - 含まれている400,000 GB-s) x $12.50 / 1,000,000 = $133.24。

推定合計: $0.41 (リクエスト) + $133.24 (計算期間) + 最低$5/月の使用料 = $138.65 per month。

例3

この例は、WebSocketを使用して各耐久オブジェクトに接続された単一のクライアントにユーザー固有の状態を通信する水平スケールの耐久オブジェクトベースのアプリケーションを表しています。

  • 100の耐久オブジェクトがそれぞれに1つのWebSocket接続を確立しています。
  • クライアントは、耐久オブジェクトが月全体アクティブであるように、月の毎秒1メッセージを送信しました。

このシナリオでは、推定月額コストは以下のように計算されます:

リクエスト:

  • 100のWebSocket接続リクエスト。
  • 1メッセージ/秒 * 100接続 * 60秒 * 60分 * 24時間 * 30日 = 259,200,000 WebSocketメッセージリクエスト。
  • 100 + (259.2百万リクエスト / 20のWebSocket請求比率) = 12,960,100リクエスト。
  • (12.9百万リクエスト - 含まれている100万リクエスト) x $0.15 / 1,000,000 = $1.79。

計算期間:

  • 100の耐久オブジェクト * 60秒 * 60分 * 24時間 * 30日 = 259,200,000秒
  • 259,200,000秒 * 128 MB / 1 GB = 33,177,600 GB-s
  • (33,177,600 GB-s - 含まれている400,000 GB-s) x $12.50 / 1,000,000 = $409.72

推定合計: $1.79 (リクエスト) + $409.72 (計算期間) + 最低$5/月の使用料 = $416.51 per month

例4

この例は、WebSocket休眠を使用してゲーム、チャット、またはリアルタイムのユーザー状態を接続されたクライアント間でブロードキャストする中程度のトラフィックの耐久オブジェクトベースのアプリケーションを表しています:

  • 100の耐久オブジェクトがそれぞれに100の休眠可能なWebSocket接続を確立しています。
  • クライアントは毎分1メッセージを送信し、webSocketMessage()ハンドラーで1つのメッセージを処理するのに10msかかります。各耐久オブジェクトは100のWebSocketを処理するため、累積的に各耐久オブジェクトは毎分1秒間JSを実行します(100のWebSocket * 10ms)。

このシナリオでは、推定月額コストは以下のように計算されます:

リクエスト:

  • 100のWebSocket接続 * 100の耐久オブジェクトでWebSocketを確立 = 10,000初期WebSocket接続リクエスト。
  • 100メッセージ/分1 * 100の耐久オブジェクト * 60分 * 24時間 * 30日 = 432,000,000リクエスト。
  • 10,000 + (432百万リクエスト / 20のWebSocket請求比率) = 21,610,000百万リクエスト。
  • (21.6百万リクエスト - 含まれている100万リクエスト) x $0.15 / 1,000,000 = $3.09。

計算期間:

  • 100の耐久オブジェクト * 1秒2 * 60分 * 24時間 * 30日 = 4,320,000秒
  • 4,320,000秒 * 128 MB / 1 GB = 552,960 GB-s
  • (552,960 GB-s - 含まれている400,000 GB-s) x $12.50 / 1,000,000 = $1.91

推定合計: $3.09 (リクエスト) + $1.91 (計算期間) + 最低$5/月の使用料 = $10.00 per month

1 100メッセージ/分は、100のクライアントが各DOに接続し、それぞれが1分ごとに1メッセージを送信することから来ています。

2 この例では、各耐久オブジェクトが毎分1秒間アクティブであるため、1秒を使用しています。これは、各リクエストが実行されるのに10msかかる432百万リクエストとしても考えることができます(4,320,000秒)。

トランザクショナルストレージAPIの請求

The Durable Objects 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 units1,21 million, + $0.20/million
Write request units31 million, + $1.00/million
Delete requests41 million, + $1.00/million
Stored data51 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 3 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 1 read request unit.

3 Each alarm write is billed as a single write request unit.

4 Delete requests are unmetered. For example, deleting a 100 KB value will be charged one delete request.

5 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.

Requests that hit the Durable Objects in-memory cache or that use the multi-key versions of get()/put()/delete() methods are billed the same as if they were a normal, individual request for each key.