Workers
We use Temporal to run workflows and activities in the background. If you have not used Temporal before, their docs have a comprehensive introduction. We recommend reading that to get used to the concepts that we use on a daily basis.
Temporal Workers
Section titled “Temporal Workers”Temporal provides different types of workers to handle different workloads. Our setup includes:
- Default Worker: Handles I/O bound workflows and activities (API calls, database operations)
- Document parser: Handles document parsing, image extraction, and selective PDF OCR
Default Worker
Section titled “Default Worker”The default worker uses a thread pool executor to handle I/O bound operations. This worker:
- Runs workflows and activities that are primarily I/O bound
- Uses
ThreadPoolExecutorfor concurrency - Handles most of our business logic workflows
Document parser
Section titled “Document parser”The document parser is the single ingestion service for supported document formats. It:
- Parses Office files through AnyDoc
- Parses PDFs and selectively OCRs image-only pages through pdf-inspector
- Runs on the
document-parsertask queue
Our Setup
Section titled “Our Setup”Our backend is highly concurrent and, for the most part, I/O bound. Most of our time is spent waiting for API calls to LLMs and other external services.
Worker Configuration
Section titled “Worker Configuration”Workers are configured in our Docker setup:
worker: image: slidespeak-backend-code command: python -m server.temporal.worker depends_on: - temporal
document-parser: image: slidespeak-document-parser command: bun run start depends_on: - temporal