リソース · 77

API割り当てと制限

制限は容量、再試行、利用者間の配分に影響します。

更新済み · 14 min

資料と地図を収めた無人の情報アーカイブ AIで生成した編集用イラスト

このガイドが達成するのに役立つこと

  • 予算を定義する
  • 復旧を有限にする
  • 不確かな操作を解決する
  • 再試行の責任を決める
  • 不要になった仕事を停止する

クイックチェック

  • 割り当て範囲、ヘッダー、待機、再試行予算を記録し、計画的な枯渇を試します。
  • 同時の再試行は過負荷を悪化させる場合があります。

手順

  1. 1

    予算を定義する

    制限がアカウント、キー、対象のどれに適用されるか、同時実行をいくつ許可するかを記録します。平均頻度が低くても、無制限の待ち行列は過負荷を招きます。

    制限単位、並列数、待ち行列の大きさを記録します。

  2. 2

    復旧を有限にする

    429でRetry-Afterがあれば解釈し、次の要求まで待ちます。待機時間の増加とクライアント間の分散を、試行回数と全体期限の上限と組み合わせます。

    試行順序と時刻を保存します。

  3. 3

    不確かな操作を解決する

    書き込み応答が失われたら、再試行前に状態を確認します。模擬試験で制限、遅延応答、中止を組み合わせ、重複した効果なく行列が終了するか確認します。

    最終的な効果と保留操作を保存します。

  4. 4

    再試行の責任を決める

    アプリ、SDK、プロキシ、依存先の自動試行を整理します。責任層を選び、契約に応じ追加再試行を無効化または調整します。最初の試行も予算に含めます。操作IDを保存し、非冪等操作の再試行前に不明な作用を確認します。

    再試行表と操作全体の予算。

  5. 5

    不要になった仕事を停止する

    クライアントの実際の制約を踏まえ、待機、接続、処理を含む期限を設定します。期限切れをキュー受入れ前に拒否します。ローカル取消しはサーバー停止を証明しないため状態を照合します。全キューを同時再開せず段階的に復旧します。

    伝達した期限と停止または照合の証拠。

再現できる受け入れ事例

架空の例です。顧客や実際の観測結果を示すデータではありません。

事例の入力を見る
{
    "http_status": 429,
    "retry_after_seconds": 30,
    "workers": 20,
    "retry_budget": 3,
    "retry_budget_scope": "per_worker_retries_excluding_initial_request",
    "scheduling_example": {
        "response_received_at_seconds": 0,
        "illustrative_retry_seconds": [
            30,
            31,
            32,
            33,
            34
        ],
        "workers_per_second": 4,
        "alternative_deadline_seconds": 25,
        "total_attempts_if_all_retries_used": 80
    }
}

期待される判断

30秒待ち、20ワーカーの再試行を分散し、回数を制限します。

20クライアントの再試行を分散し、回数を数える

架空の例:20ワーカーが +0 s にそれぞれ 429 と Retry-After: 30 を受信します。時刻は分散例であり、サーバー容量を保証しません。各ワーカーは初回要求に加えて3回再試行できます。

方針計算または時刻変化と限界
一斉に再試行20 × 1 = 20 @ +30 s30秒待てば指定の待ち時間は守れますが、20件が同時に戻るため、負荷の集中が再発し得ます。
再試行を分散4 × 5 = 20 @ +30…+34 s毎秒4件を5秒間に分けると、20件の再試行を分散できますが総数は減りません。この例示スケジュールは、ランダムな揺らぎを加えたバックオフ方針の代わりにはなりません。
期限が25秒後25 s < 30 s → 0残り時間が指定の30秒未満なら、契約に従って中止または延期します。期限に合わせて待ち時間を短縮しません。
最大試行数20 × (1 + 3) = 80すべて使うと、初回20件と再試行60件で合計80件です。上限があっても成功や安全な繰り返しは保証されません。

検証する架空のバリエーション

Retry-Afterの値が秒数ではなくHTTP日付である。

文書化された形式を解釈し、時計を確認します。計算した待機時間を記録し、日付を任意の待ち時間に置き換えないでください。

各ワーカーが個別に再試行回数の上限を持つ。

合計負荷も計算します。共有クォータを調整し、再試行を分散して同時集中の再発を避けます。

業務上の効果を持つ操作の応答が返らない。

再実行前に正とする状態と冪等性の契約を確認します。タイムアウトは操作が実行されなかった証拠ではありません。

残すべき証拠

  • 受信ヘッダー、待機形式、使用した時計。
  • 合計の試行予算と最大時間。
  • 操作IDと照合済みの結果。

補足資料 : IETF — RFC 9110, Retry-After [EN]

検証手順

  1. 割当範囲と再試行予算を記録します。
  2. 許可された試験だけで枠を使い切ります。
  3. 429、Retry-After、制限付き時系列を残します。 技術的な制限と業務結果を区別します。クォータの枯渇を在庫ゼロという応答に変換しないでください。
  4. 外部負荷のない模擬環境で四層各三回の総呼出しを数えます。
  5. 架空のキュー仕事を期限切れにし、新しい操作が始まらないことを確認します。
  6. 模擬障害後に許可された仕事を段階再開し、呼出し、期限、一意な結果を保存します。

AWS — Timeouts, retries, and backoff with jitter

API:層をまたぐ再試行の増幅を防ぐ

アプリ、SDK、プロキシ、サービスが同じ呼出しを再試行する場合があります。架空の四層が各三回の総試行を行うと、障害依存先へ最大81回届きます。既存の割当て管理に共通予算と有用な期限を加えます。

架空の事例

具体的な状況

割り当て範囲、ヘッダー、待機、再試行予算を記録し、計画的な枯渇を試します。

決定と期待される証拠

いいえ。応答が失われた操作を別途照合します。別の試行への応答から状態を判断しません。

管理指標

指標測定対象最初のアクション
操作ごとの試行数同じ論理操作に送った試行数予算を調整してループを停止
待ち行列の経過時間タスク受理からの待機時間期限切れタスクを中止または引き継ぐ
呼出し増幅依存先の呼出し / 同じ期間の元操作総試行、再試行、予定された子呼出しを区別
期限切れ受入れ有用な期限後に開始した仕事キュー、取消し、開始済み作用も観察

よくある間違い

  • 同時の再試行は過負荷を悪化させる場合があります。

よくある質問

429は以前の書き込みが未実行だった証拠ですか?

いいえ。応答が失われた操作を別途照合します。別の試行への応答から状態を判断しません。

各層三回は全体三回ですか?

いいえ。架空の四層で各三回なら最終依存先へ最大3⁴ = 81回です。

期限切れは遠隔作用を取り消しますか?

必ずしもそうではありません。新しい不要な仕事を止め、開始済み操作は状態確認と可能な補償が必要です。

Retry-After:待機・予算・再試行判断

この言語版の詳しい参照メモは英語で提供しています。

Decide whether to retry after 429 or 503

A waiting period answers “when?”, not “may this operation be repeated?”. Before retrying, identify the intended effect, read the provider contract and bound total work. An error status or a lost response does not prove that no earlier attempt produced an effect.

Local teaching model with no request, timer, storage or real write. It considers one decision after 429 or 503 using six predefined headers. Dates are read at the fictional instant 22 October 2026, 10:00:00 UTC, assuming an accurate clock. This is neither a complete HTTP parser nor a Stripe client. Obsolete HTTP-date forms, clock skew, transport and SDK-specific policies are outside the calculation.

架空の無人ネットワーク実験室。琥珀色の照明の下、暗い作業台に機器が並ぶ。 AIで生成した編集用イラスト
Generated, people-free conceptual network laboratory from the editorial collection. It depicts neither real infrastructure nor a throughput test.

Twelve ways to read Retry-After

Durations are seconds. Absolute dates need an explicit clock policy; calculations here assume the stated accurate clock. Past dates become zero in this model without permitting an immediate loop. Integer syntax alone does not define a client’s numeric limits.

Twelve ways to read Retry-After
Illustrative valueReading within this scopeInterpretation decision
30Non-negative decimal integer: wait 30 seconds after receipt.This means seconds, not 30 milliseconds.
0005The 1*DIGIT syntax accepts these digits: 5 seconds.Do not treat the leading zero as octal.
0A declared delay of zero seconds.Local policy, budgets and permission to repeat still require checking.
Thu, 22 Oct 2026 10:00:45 GMTAn HTTP date 45 seconds after the fictional receipt time.Clock uncertainty must not be silently treated as certainty.
Thu, 22 Oct 2026 09:59:50 GMTA date 10 seconds in the past; the model uses zero server wait.A past date requires neither negative waiting nor unlimited replay.
Field absentNo server wait is supplied.This model uses its selected local delay, not a normative default.
1.51.5 does not meet integer delay-seconds syntax.Do not silently round it and call the field valid.
-1-1 is not a non-negative decimal integer for this field.Do not interpret it as a special permission.
30sThe s unit suffix is not part of delay-seconds syntax.Seconds are already implied; 30s is not the form 30.
30, 60Two comma-separated durations are not one valid Retry-After value.Do not split every comma: a valid HTTP date itself contains one.
Empty valueThe field exists but contains neither expected form.Keep absent and malformed values distinct in records.
9999999999999999999999The digit string meets integer syntax but exceeds this model’s numeric bounds.Record the local limit without claiming the RFC sets it; never truncate to retry sooner.

Compare waiting, remaining budget and duplicate risk

Five parameters cover 144 combinations. Fictional policy: wait for the greater of an interpretable server delay and the already selected local delay, then reserve 10 seconds for one attempt. If the remaining budget is insufficient, stop this interactive retry without shortening the server wait. The reserve is not a measured duration and the selected local delay is not a jitter generator.

Teaching decision : Retry candidate

The selected operation type and budget allow considering a retry in this model. This proves neither success nor authorisation on a real service.

Interpretable server wait
30 s
Selected wait
30 s
Attempt reserve
10 s
Wait + reserve
40 s
Budget margin
20 s

Eight reproducible cases

Eight reproducible cases
Fictional situationRelevant parametersDecision and limit
429, read and 30-second wait429 · 30 seconds

Conforming GET read

Remaining budget after receipt : 60 s
Already selected local delay : 5 s

Retry candidate

With 60 seconds remaining, 30 + 10 leaves a 20-second margin.

Waiting exceeds the budget429 · 30 seconds

Conforming GET read

Remaining budget after receipt : 20 s
Already selected local delay : 5 s

Stop this retry

With 20 seconds remaining, do not shorten 30 just to force an attempt.

Write with unknown contract503 · Future date: +45 seconds

POST write: retry contract unverified

Remaining budget after receipt : 60 s
Already selected local delay : 5 s

Check business state

Even positive margin does not validate repeating POST.

Write with verified contract503 · Future date: +45 seconds

POST write: retry contract verified

Remaining budget after receipt : 60 s
Already selected local delay : 5 s

Retry candidate

Verified contract is an assumption, not a test of your provider.

Invalid fractional value503 · Invalid value: 1.5

Conforming GET read

Remaining budget after receipt : 20 s
Already selected local delay : 5 s

Retry candidate

The five-second fallback is a local teaching choice; retain the parse error.

Absent field, long local delay429 · Field absent

Conforming GET read

Remaining budget after receipt : 60 s
Already selected local delay : 40 s

Retry candidate

The 40-second delay comes from the client rather than the server.

HTTP date already passed503 · Past date: −10 seconds

Conforming GET read

Remaining budget after receipt : 20 s
Already selected local delay : 5 s

Retry candidate

The model retains a five-second local delay; the past date triggers no immediate call.

Zero does not remove the budget429 · 0 seconds

Conforming GET read

Remaining budget after receipt : 20 s
Already selected local delay : 40 s

Stop this retry

The 40-second local delay plus reserve exceed the 20 seconds remaining.

Five distinctions that change client behaviour

Five distinctions that change client behaviour
Reference pointDocumented meaningPractical limit
429RFC 6585 describes too many requests within a period. Retry-After may be present; a 429 response must not be stored by a cache.The RFC does not set the provider’s counted identity, window or algorithm.
503Retry-After can indicate the expected duration of service unavailability.A 5xx alone does not establish whether a write can be replayed.
HTTP idempotencePUT, DELETE and safe methods are idempotent in their intended effect.Responses and logs may differ. Controlled POST retries need an additional contract.
Retries at multiple layersClient, SDK and proxy attempts can multiply load.In a fictional three-layer example with three total attempts at each layer, one request can generate up to 3 × 3 × 3 = 27 calls at the last layer.
Jitter and budgetAWS describes spreading retries to avoid synchronised clients.Randomness makes no write idempotent and replaces neither a deadline nor an attempt limit.

Five items for retry acceptance evidence

  • Method, route, contract version and logical operation identity; keep secrets out of keys and logs.
  • Status, raw field, receipt time, interpretation and clock assumption.
  • Selected delay, current attempt, remaining budget and the layer actually controlling retries.
  • Known or unknown business state, retry key, associated context and parameters, and reconciliation evidence when needed.
  • Verified final outcome and user behaviour: understandable waiting, retained input and no button that unintentionally recreates an operation.

Compare idempotency contracts →

Primary sources and limits

The RFCs define the cited HTTP elements. AWS describes design choices and Stripe documents its own APIs. Budgets, local waits, cases and diagrams are educational: they neither measure your service nor execute requests.

References reviewed

GraphQL:エラー・リスト・部分データ

この言語版の詳しい参照メモは英語で提供しています。

GraphQL cost and partial results: two separate checks

An authorized query can still be too costly; a partial response measures none of its resource consumption.

  • Compare absent data, partial data and data: null.
  • Keep the original path even when a parent becomes null.
  • Test permissions, quotas and interface states separately.

Explore GraphQL responses and nullability →

GraphQL Specification · September 2025 · Published edition · September 2025

公式参照文献

参照文献はメソッドを裏付けるものです。 チェックは状況に合わせて調整してください。 これらは認証ではありません。 元の参照文献のタイトルやソース文書は別の言語で書かれている場合があります。

参照資料の確認日 .