A sophisticated distributed task processing system built in Go, featuring auto-scaling workers, work stealing, priority-based scheduling, and comprehensive monitoring capabilities.
- Advanced Worker Management
- Auto-scaling worker pools
- Work stealing between workers
- Health monitoring and heartbeats
- Graceful shutdown handling
- Intelligent Task Processing
- Priority-based task scheduling (1-10)
- Task deadlines and timeouts
- Configurable retry mechanism
- Real-time task status updates
- Modern Dashboard
- Real-time metrics visualization
- Dark mode interface
- Interactive worker management
- Task submission interface
- Priority queue visualization
- Robust Architecture
- Redis-backed task distribution
- React-based frontend
- RESTful API integration
- Production-ready error handling
┌─────────────┐ ┌─────────────┐
│ Next.js │◄────┤ API │
│ Frontend │ │ Server │
└─────────────┘ └──────┬──────┘
│
Redis Queue
│
▼
┌─────────────┐ ┌─────────────┐
│ Worker 1 │ │ Worker 2 │
└─────────────┘ └─────────────┘
- Go 1.23 or later
- Redis server
- Node.js 18 or later
- npm/yarn
- Clone the repository:
git clone https://github.com/NotMalek/DistributedTaskProcessingSystem.git
cd DistributedTaskProcessingSystem
- Install backend dependencies:
go mod tidy
- Install frontend dependencies:
cd frontend
npm install
# or
yarn install
redis-server
# Basic start
go run main.go
# With custom Redis and port
go run main.go -redis localhost:6379 -port 8080
cd frontend
npm run dev
# or
yarn dev
The dashboard will be available at http://localhost:3000
# Start a new worker
POST /api/workers/start
{
"poolSize": 5,
"enableSteal": true,
"minWorkers": 1,
"maxWorkers": 10
}
# Stop a worker
POST /api/workers/stop?id={workerId}
# Get worker list and status
GET /api/workers
# Submit a new task
POST /api/tasks/submit
{
"priority": 5,
"deadline": "2024-01-30T15:04:05Z",
"retries": 3,
"taskType": "test",
"payload": "task data here"
}
# Get task status
GET /api/tasks/status?id={taskId}
# Get system metrics
GET /api/metrics
# Get detailed debug information
GET /api/debug
# Reset the entire system
POST /api/system/reset
- Active worker count
- Total tasks in system
- Processed tasks count
- Failed tasks count
- Priority queue lengths visualization
- Add/remove workers
- Configure worker pool size
- Enable/disable task stealing
- Set min/max worker limits
- Monitor worker status and health
- Submit new tasks
- Set task priorities
- Configure deadlines
- Specify retry attempts
- Monitor task status
- Reset system state
- Real-time metrics updates
- Error tracking and reporting
.
├── internal/
| ├── api/ # Configuration management
| | └──server.go
│ ├── config/ # Configuration management
| | └──config.go
│ ├── coordinator/ # Coordinator implementation
| | └──coordinator.go
│ ├── task/ # Task definitions and scheduling
│ | ├── scheduler.go
│ | └── task.go
│ └── worker/ # Worker implementation
│ ├── autoscaler.go
│ ├── metrics.go
│ ├── stealing.go
│ └── worker.go
├── main.go
└── README.md
frontend/
├── src/
│ ├── app/
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ └── components/
│ ├── ui/
│ │ └── card.tsx
│ └── dashboard/
│ ├── metrics-cards.tsx
│ ├── queue-chart.tsx
│ ├── system-management.tsx
│ ├── task-submission.tsx
│ └── worker-status.tsx
├── package.json
└── tsconfig.json