How mosecorg/mosec works
Main Components
a. Core Components:
• Web Server Layer (Rust-based)
• Task Coordinator
• Worker Pipeline System
• Dynamic Batching Manager
• Monitoring System
b. Integration Components:
• Client Interface
• Model Storage
• Metrics Endpoint
• OpenAPI Documentation
Client Layer
API Layer (Rust)
Coordination Layer
• Dynamic Batching
• Task Distribution
Worker Pipeline Layer
• Worker Pool 1 (Stage 1)
• Worker Pool 2 (Stage 2)
• Worker Pool N (Stage N)
Model Layer
Key Elements and Relationships
a. Request Flow:
• Dynamic batching aggregation points
• How batched requests are distributed to workers
b. Process Communication:
• IPC (Inter-Process Communication) between stages
• Shared memory options (Redis/Plasma)
• Serialization/deserialization points
c. Monitoring Flow:
• Metrics collection points
• Prometheus integration
• Monitoring dashboard connection
Technical Details
• Protocol support (JSON/msgpack)
• Worker process pools
• Batch size configuration
• Wait time parameters
• GPU memory management
• IPC mechanisms
Implementation Details
• Server class (mosec/server.py)
• Worker implementation (mosec/worker.py)
• Coordination logic (mosec/coordinator.py)
• Mixin capabilities (mosec/mixin/)
External Integration Points
Connections to:
• Kubernetes integration points
• Monitoring systems
• Model storage systems
• Client applications