Table of Contents
For non-real-time AI workloads, event-driven architecture beats request-response on throughput, resilience, batching efficiency. Kafka / Pub/Sub / SQS / RabbitMQ trigger AI inference; results published to downstream topics; consumers process. Standard distributed-systems patterns applied to AI.
Pattern: source event → queue → AI worker pulls + processes → result published. Backpressure handling, retry, dead-letter all standard. AI-specific: batch multiple events for vLLM efficiency; idempotency on retries; structured-output validation in worker. Right for: doc processing, periodic summarisation, async classification.
Patterns
- Pub/Sub fan-out: one event → multiple AI processors (translate, classify, summarise) in parallel
- Worker pool: shared queue; N workers pull and process; auto-scale on queue depth
- Batching: workers accumulate events for ~1-5 seconds; batch-call AI for efficiency
- Pipeline stages: chain queues for multi-step AI workflows (extract → analyse → categorise)
- Dead-letter queue: failed events for manual review
Backpressure
- Rate-limit at queue layer to prevent saturating AI tier
- Auto-scale workers based on queue depth
- Cap concurrent AI calls per worker
- Acknowledgement after success only (idempotency on retry)
- Monitor lag; alert on growing backlog
Examples
- Document processing: doc upload → SQS → AI worker (OCR + extraction + classification) → result topic
- Customer support: ticket created → pubsub → AI suggests resolution → updates ticket
- Content moderation: user post → queue → AI classifies safety → gates publishing
- Embedding ingest: source change → CDC event → embedding worker → updates Qdrant
Verdict
For async / batch / pipeline AI workloads, event-driven architecture is the right shape. Standard distributed-systems patterns apply with AI-specific extensions (batching, idempotency, structured-output validation). vLLM's continuous batching benefits compound with worker-level batching for excellent throughput.
Bottom line
Standard event-driven; AI-specific batching. See batch vs stream.