How shopify/semian works
Main Components Overview
a) Core Components:
• Circuit Breaker System
• Bulkhead System
• Resource Management Layer
• Adapter Layer
• Instrumentation System
b) External Integration Points:
• Database Adapters (MySQL2, Redis, etc.)
• HTTP Clients
• Active Record Integration
• SysV Semaphores (System Level)
Detailed Component Breakdown
Circuit Breaker Component:
[Circuit Breaker]
• State Management
• Closed State (Normal Operation)
• Open State (Failing Fast)
• Half-Open State (Testing Recovery)
• Error Tracking
• Success Tracking
Bulkhead Component:
[Bulkhead System]
• Ticket Management
• Ticket Allocation
• Ticket Release
• SysV Semaphore Integration
• Worker Registration
Component Relationships and Data Flow
Client Request → Resource Access Layer
• ↓
• Circuit Breaker Check
• ↓
• Bulkhead Check
• ↓
• Adapter-Specific Logic
• ↓
• External Resource
Implementation Details to Highlight
• SysV semaphore usage for cross-process coordination
• Local state management in circuit breakers
• Resource quota management
• Error threshold tracking
• Success threshold tracking
[Client Applications]
• ↓
[Semian Resource Layer]
• Circuit Breaker
• State Management
• Bulkhead
• Ticket Management
• Adapter Layer
• ↓
[External Resources]
Additional Notes
• Timing indicators for critical paths
• Configuration points
• Monitoring/metric collection points
This system design should be created using a tool that supports:
• Clear hierarchical relationships
• Bidirectional flows
• State transitions
• Component grouping
• Detailed annotations