Distributed Task Processing & Workflow Engine
Asynchronous task execution mesh with FastAPI, Redis Queue, PostgreSQL durability & React telemetry
Empirical benchmark comparing INT8 Post-Training Quantized ONNX against vanilla TorchScript C++ tracing.
01 // SYSTEM OVERVIEW
This project implements a decoupled distributed task execution engine designed to demonstrate foundational backend engineering principles: asynchronous task ingestion, durable state tracking in PostgreSQL, low-latency queuing with Redis, decoupled worker processes, and deterministic fault-handling policies.
02 // THE PROBLEM & ENGINEERING SIGNIFICANCE
Monolithic applications often execute computationally heavy tasks (PDF generation, data ingestion, external API calls) synchronously inside the web request lifecycle, causing timeouts, memory bloat, and cascading server failures.
Production systems require asynchronous worker decoupling where task ingestion is instantaneous, state is durable across power cycles, and failed tasks are safely retried without human intervention.
- •Preventing task loss when worker nodes crash mid-execution.
- •Guaranteeing idempotency and avoiding duplicate task runs.
- •Maintaining real-time visibility into queue depth and worker error rates.
03 // DATA PIPELINE & PREPROCESSING
- Pydantic schema validation and task parameter sanitization
- Unique task UUID generation and initial PENDING state record creation in PostgreSQL
- Serialization to Redis list queue with priority indexing
04 // SYSTEM ARCHITECTURE & DATA FLOW
Client (React UI / CLI) -> FastAPI API Layer -> PostgreSQL (Durable State) -> Redis (In-Memory Queue) -> Decoupled Worker Daemons -> PostgreSQL Status Update -> React Telemetry.
Receives task creation requests, persists state, and pushes task IDs to Redis queue.
PostgreSQL database storing task lifecycle (PENDING, RUNNING, COMPLETED, FAILED, RETRYING).
Low-latency in-memory FIFO queue facilitating non-blocking worker polling.
Independent worker daemon consuming tasks, executing logic, and handling retries.
05 // MODEL ENGINEERING & HYPERPARAMETERS
Benchmarked under concurrent synthetic load with worker chaos termination scripts.
- • Max Retries: 3
- • Base Backoff: 2.0s
- • Worker Concurrency: 4
- • Poll Timeout: 1.0s
06 // FAILURE ANALYSIS & ZERO-TRUST SAFEGUARDS
- • Worker crash while task is in RUNNING state.
- • Database connectivity loss during task completion write.
07 // PRODUCTION DEPLOYMENT SPECS
08 // ARCHITECTURAL DECISIONS & TRADE-OFFS
09 // PLANNED IMPROVEMENTS & NEXT REVISIONS
- →Implement distributed locking via Redlock for mutually exclusive task workflows.
- →Add WebSocket subscriptions for instantaneous frontend task progress streaming.