data-infra
Glossary ↗Batch Processing
Batch processing is a computing pattern where a large volume of work is collected and processed together as a group ("a batch"), typically on a schedule (nightly, hourly) or once a threshold is reached, rather than being processed immediately, item-by-item, as each request arrives (the alternative pattern, real-time or stream processing). Why it matters for AI/SaaS builders: batch processing is one of the most effective and underused cost-reduction levers available on AI infrastructure specifically, because major LLM providers (OpenAI, Anthropic, Google) offer dedicated batch APIs that process requests within a 24-hour window at a substantial discount — commonly 50% off standard pricing — in exchange for giving up real-time response guarantees. For any AI workload that doesn't need an instant response (generating embeddings for a document backlog, classifying a week's worth of support tickets, re-scoring a product catalog after a prompt improvement, running eval suites against a model), routing the work through a batch API instead of the standard synchronous API is close to a free cost cut. How it works: a batch job is typically submitted as a file (often JSONL — one JSON request object per line) describing many independent requests at once; the provider processes them asynchronously, generally completing well within 24 hours (often much faster), and returns a results file mapping each request to its response. This maps naturally onto data pipeline architecture — the "transform" or "load" stage of an ETL pipeline is frequently itself implemented as a batch job. The trade-off against real-time processing is latency (batch jobs complete in minutes to hours, not milliseconds) and immediacy of feedback (errors surface after the whole batch runs, not per-request), so batch processing is the right choice specifically when a workload is bulk, non-urgent, and cost-sensitive — and the wrong choice for anything a user is actively waiting on in an open browser tab. Worked example: a content-marketing SaaS needs to generate SEO meta descriptions for 40,000 existing blog posts in its customers' CMSs after adding a new AI feature. Calling the standard synchronous LLM API for all 40,000 posts would be both slow (rate-limited, one at a time) and expensive at full price. Instead, the team writes a JSONL file with one meta-description-generation request per post, submits it to the LLM provider's batch API, and 6 hours later downloads a results file, running a pipeline job that writes each generated description back into the corresponding CMS record — at roughly half the API cost of the synchronous alternative and without competing for the same rate limits the live product's real-time features need.
Related terms