Skip to content

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 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

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 ThreadPoolExecutor for concurrency
  • Handles most of our business logic workflows

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-parser task queue

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.

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