欢迎使用 FlowZap,快速、清晰、掌控的绘图应用。

舱壁隔离架构

Architecture

舱壁隔离架构图,为关键、标准和批处理工作负载提供独立的线程池,每个都有独立的连接池、耗尽检测和背压策略,防止一个工作负载饿死其他工作负载。该模板模拟受船体舱壁启发的隔离模式,资源隔离确保一个组件的故障或过载不会级联到其他组件。对于需要为高优先级操作保证可用性的系统至关重要。

完整 FlowZap 代码

Gateway { # API Gateway
n1: circle label:"Incoming Request"
n2: rectangle label:"Classify Request Type"
n3: diamond label:"Request Category?"
n4: rectangle label:"Route to Critical Pool"
n5: rectangle label:"Route to Standard Pool"
n6: rectangle label:"Route to Batch Pool"
n1.handle(right) -> n2.handle(left)
n2.handle(right) -> n3.handle(left)
n3.handle(right) -> n4.handle(left) [label="Critical"]
n3.handle(bottom) -> n5.handle(top) [label="Standard"]
n3.handle(left) -> n6.handle(right) [label="Batch"]
n4.handle(bottom) -> CriticalPool.n7.handle(top) [label="Priority"]
n5.handle(bottom) -> StandardPool.n11.handle(top) [label="Normal"]
n6.handle(bottom) -> BatchPool.n15.handle(top) [label="Low Priority"]
}
CriticalPool { # Critical Thread Pool (10 threads)
n7: rectangle label:"Dedicated Connection Pool"
n8: rectangle label:"Process Payment Request"
n9: diamond label:"Pool Exhausted?"
n10: rectangle label:"Queue with Timeout"
n7.handle(right) -> n8.handle(left) [label="Thread Available"]
n7.handle(bottom) -> n9.handle(top) [label="Check"]
n9.handle(right) -> n10.handle(left) [label="Yes"]
n9.handle(top) -> n8.handle(bottom) [label="No"]
}
StandardPool { # Standard Thread Pool (20 threads)
n11: rectangle label:"Shared Connection Pool"
n12: rectangle label:"Process API Request"
n13: diamond label:"Pool Exhausted?"
n14: rectangle label:"Return 503 Service Unavailable"
n11.handle(right) -> n12.handle(left) [label="Thread Available"]
n11.handle(bottom) -> n13.handle(top) [label="Check"]
n13.handle(right) -> n14.handle(left) [label="Yes"]
n13.handle(top) -> n12.handle(bottom) [label="No"]
}
BatchPool { # Batch Thread Pool (5 threads)
n15: rectangle label:"Rate-Limited Pool"
n16: rectangle label:"Process Batch Job"
n17: diamond label:"Pool Exhausted?"
n18: rectangle label:"Backpressure: Delay Retry"
n15.handle(right) -> n16.handle(left) [label="Thread Available"]
n15.handle(bottom) -> n17.handle(top) [label="Check"]
n17.handle(right) -> n18.handle(left) [label="Yes"]
n17.handle(top) -> n16.handle(bottom) [label="No"]
}

为什么需要这个工作流?

A single slow or failing dependency can consume all available threads or connections, starving healthy operations. The bulkhead pattern isolates workloads into separate resource pools—like watertight compartments in a ship—so that a failure in one pool cannot affect the availability of others.

工作原理

  1. Step 1: Incoming requests are classified by type: critical, standard, or batch.
  2. Step 2: Each category is routed to a dedicated thread pool with fixed capacity.
  3. Step 3: The critical pool (payments) has guaranteed resources that cannot be consumed by other workloads.
  4. Step 4: The standard pool handles regular API requests with a larger thread allocation.
  5. Step 5: The batch pool processes background jobs with rate limiting and lower priority.
  6. Step 6: When a pool is exhausted, requests are either queued with timeout or rejected with 503.

替代方案

A single shared thread pool is simpler but vulnerable to noisy-neighbor problems. Kubernetes resource limits provide pod-level isolation. This template shows application-level bulkhead isolation for fine-grained workload protection.

Key Facts

Template Name舱壁隔离架构
CategoryArchitecture
Steps6 workflow steps
FormatFlowZap Code (.fz file)

相关模板

熔断器弹性架构

Architecture

熔断器弹性架构图,展示完整的状态机,包括关闭、打开和半开状态、故障阈值跟踪、恢复计时器以及保护服务免受级联故障的降级响应策略。该模板详细可视化熔断器模式,包括熔断器如何根据成功和失败计数在状态之间转换。对于构建在负载下优雅降级的容错微服务至关重要。

指数退避重试架构

Architecture

指数退避重试架构图,展示完整的重试策略引擎,包括可重试与不可重试错误分类、带抖动的指数延迟计算、最大重试阈值和优雅的耗尽处理。该模板模拟处理分布式系统中瞬态故障的基本弹性模式,通过随机退避延迟防止惊群问题。对于云架构中任何服务间通信都是基础性的。

基于单元的架构

Architecture

基于单元的架构图,展示地理路由到独立、自包含的单元(US-East、EU-West),每个单元拥有自己的网关、计算、数据库、缓存和消息队列,加上用于跨单元复制和全局配置的共享服务。该模板模拟超大规模系统使用的单元架构模式以实现爆炸半径隔离,一个单元的故障不会影响另一个单元的用户。对于设计需要极高可用性和故障隔离的系统的架构师至关重要。

微服务 API 网关架构

Architecture

微服务 API 网关架构图,展示请求路由、JWT 身份验证、速率限制、服务发现以及跨分布式后端服务的响应聚合。该模板模拟微服务生态系统中所有客户端流量的入口点,在请求到达内部服务之前执行安全策略。适合设计具有集中式横切关注点的可扩展 API 基础设施的平台工程师。

微服务服务网格架构

Architecture

服务网格架构图,展示 Istio 或 Linkerd 边车代理处理 mTLS 加密、流量策略、熔断器和跨微服务的分布式追踪。该模板可视化服务网格如何将网络关注点从应用代码中抽象出来,实现服务间的零信任通信。对于采用服务网格基础设施以提升可观测性和安全性的团队至关重要。

微服务每服务独立数据库架构

Architecture

每服务独立数据库架构图,每个微服务拥有其专用数据存储,通过 Kafka 进行事件驱动同步以实现跨服务数据一致性。该模板展示了微服务数据隔离的核心原则,展示 PostgreSQL 和 MongoDB 如何在多语言持久化策略中共存。对于在保持最终一致性的同时强制服务自治的架构师至关重要。

返回所有模板