A background service that processes tasks asynchronously, usually taken from a queue or stream.
- Async Processing (Fast)
- Scalable (can scale workers)
- Fault tolerance (worker crashed, another worker pickup and continue)
- Load Smoothing (Queue absorbs tasks)
❌ Without Worker
Slow, timeout, Not scalable
- User uploads image
- API processes image
- AI runs
- store result
- return response
✅ With Worker:
Fast API, Scalable, Reliable
- User uploads
- API saves task
- Stored into queue
- Simultaneously:
- API return immediately
- Worker picks task → process → store result