Building document pipelines that actually scale
A reference architecture for scalable document processing splits a monolithic upload-and-parse server into a thin web service, a Render Workflows orchestration layer, and a Postgres store. Five discrete TypeScript tasks (upload, classify, parse, extract, store) each run in an isolated instance with their own compute plan, timeout and exponential-backoff retry policy, so one large PDF cannot block unrelated requests and a failure doesn't restart the whole job. LlamaCloud Classify, LlamaParse's agentic tier and LlamaExtract handle document typing, layout-aware parsing to markdown and JSON-Schema field extraction. Results are optionally indexed for hybrid search and RAG, and progress streams to clients via Server-Sent Events.
Related posts
- A PDF is not a string
Render mediumAdept
Document ingestion for agents breaks because PDFs carry no structural markup, so naive text extraction scrambles multi-column layouts and tables, and frontier models lose accuracy on visual structure while returning flat text with no bounding boxes, confidence or provenance. LlamaParse splits ingestion into classification (document type plus confidence), parsing (layout-aware Markdown with OCR and preserved tables) and extraction (schema-driven JSON), so failures can be traced to a specific stage. The reference architecture on Render uses a thin Express upload service streaming progress over SSE, Render Workflows running five tasks (store, classify, parse, extract, store results), and four Postgres tables holding each intermediate output as an audit trail. Demos showed a receipt classified at 85% confidence and a 24-page bank statement fully parsed with five fields extracted.
- How Render Workflows powers our internal data pipeline
Render mediumAdept
Render's two-person data team replaced a time-spaced set of cron jobs with a Render Workflows DAG that waits for a late-arriving Go-built invoice projection dataset, runs dbt in projection-independent and projection-dependent partial builds, then fans out downstream tasks like doc sync, cost monitoring and Metabase cache warming in parallel. The key pattern is retry-as-poll: the task's native retry engine (flat backoff, max retries) checks for a sentinel row in BigQuery without burning compute between polls. dbt runs as a subprocess with stdout streamed into task logs, and completion events land in a BigQuery table that drives accurate ETA estimates. Prod, dry-run and simulate execution modes, plus confining the Render SDK to main.py, keep the logic vendor-agnostic and testable in CI. Projected savings are $30K/year from fewer dbt runs and $70K from Metabase caching.
- Processing large jobs with Edge Functions, Cron, and Queues
Supabase mediumAdeptLarge data-processing jobs on Supabase can be split into a three-layer pipeline: cron-triggered Edge Functions collect work, distributor jobs route it into per-source Postgres queue tables, and specialized workers process one item at a time to stay within serverless timeouts. The worked example is an NFL news aggregator that scrapes sites, classifies articles with OpenAI, upserts player and team entities, and stores pgvector embeddings for search. Key practices include letting unique constraints handle deduplication, always marking queue items processed in a finally block to avoid infinite retries, reporting failures to Sentry, queuing user interactions for batched trending updates, and offloading expensive work like embeddings to background tasks.
- Rapidly scaling online storage to serve over 1 billion ChatGPT users
OpenAI mediumAdept
Habitat, OpenAI's online storage platform, grew from a client-side Python library over Azure Cosmos DB into a centralized Python service handling 70M+ requests per second and 500+ PB across about 40 regions. It moved to a service because coordinating client-library rollouts across dozens of services had become slow and error-prone. Running Python at this scale meant fighting tail latency from asyncio event-loop scheduling delay, which the team measured directly and controlled by keeping per-process concurrency low and scaling out worker processes. Specific fixes included shrinking and jittering Statsig feature-flag config refreshes, and switching aiohttp's LIFO connection reuse to FIFO to break a metastable failure that concentrated load on already-slow processes.
- Keep the monolith, but split the workloads
incident.io mediumAdeptA Go monolith can get much of the reliability isolation of microservices by splitting workloads into separate deployments of the same binary, instead of breaking it into services. After a bad Pub/Sub message caused an unhandled panic that crashed the web, worker and cron threads together for 32 minutes, incident.io split them into independent Heroku dyno tiers selected by command-line flags. They also gave each class of work its own capped Postgres connection pool and statement timeout, so low-priority jobs such as BigQuery event export or best-effort nudges fall behind rather than exhausting the shared database. The main migration hazard is code that assumes a shared process, such as process-local caches, and the fix is to move that coordination into Postgres or Redis.