返回提示词目录第 1167 页

设计服务故障优雅降级方案

按依赖重要性规划故障时的用户体验,给出超时重试、隔离熔断、降级开关及验证方案。

完整提示词

<context>
Most outages that users notice are not total failures but one slow dependency dragging everything down: threads pile up waiting on it, retries multiply the load, and a non-essential widget takes the whole page with it. Graceful degradation decides in advance, per dependency, what the product does instead: hide the recommendations panel, serve a cached price list, queue the order for later confirmation, or switch to read-only. These are product decisions as much as technical ones, and some fallbacks are worse than failing (showing a stale balance, accepting an order you cannot fulfil). The mechanics are well known: tight timeouts below the caller's own budget, bulkheads that cap concurrency per dependency, circuit breakers, load shedding by priority, and switches operators can flip during an incident.
</context>

<task>
<journey>
{{journey}}
</journey>

<dependencies>
{{dependencies}}
</dependencies>

{{#business_rules}}
<business_rules>
{{business_rules}}
</business_rules>
{{/business_rules}}

1. Classify each dependency as critical (the journey cannot complete without it), degradable (the journey completes with less) or optional (can be dropped silently). Challenge any "critical" that could be degradable.
2. For each degradable or optional dependency, define the degraded mode the user experiences: hidden feature, cached or default data with a maximum age, deferred processing with a later notification, or reduced functionality. Mark fallbacks that risk correctness (stale prices, balances, stock) and the business rule that allows or forbids them.
3. For critical dependencies, define the failure experience: a clear error, a retry later message, a queue, or read-only mode, and how to keep it from cascading to other journeys.
4. Specify mechanisms per dependency: timeout (below the caller's budget, with the arithmetic), retry policy with backoff and a retry budget, bulkhead or concurrency limit, circuit breaker thresholds, and cache to serve from. Add load shedding: which request classes are dropped first when the service itself is overloaded.
5. Specify switches and signals: feature kill switches and degraded-mode flags operators can flip, which ones flip automatically, the metric and threshold that triggers each, and how users and support are told.
6. Plan verification: fault injection or game-day scenarios per dependency, what to observe, and the pass condition.
</task>

<constraints>
- Do not propose a fallback that returns wrong money, stock, permission or safety data without an explicit business rule that accepts it.
- Timeouts must be justified against the caller's budget; no blanket "30 seconds".
- Retries must have a cap and must not apply to non-idempotent calls without idempotency keys.
- Do not invent dependency SLAs; ask or label assumptions.
{{> output/uncertainty}}
</constraints>

<output_format>
## Criticality map
Table: dependency, call type, class (critical, degradable, optional), user impact if down.
## Degraded modes
Per dependency: what the user sees, data age limit, correctness risk, business rule.
## Mechanisms
Table: dependency, timeout, retries, bulkhead, breaker, cache or fallback.
## Switches and signals
Table: switch, manual or automatic, trigger metric and threshold, who is told.
## Verification
Numbered fault-injection scenarios with pass conditions.
## Open questions
Numbered, each naming who should answer.
</output_format>

可替换内容

  • {{journey}}
  • {{dependencies}}
  • {{#business_rules}}
  • {{business_rules}}
  • {{/business_rules}}
  • {{> output/uncertainty}}

分类与标签

编程开发、服务降级、容错架构、超时重试、熔断隔离、故障演练

前往 AI 图片创作