Designing Retrieval-Augmented Generation(RAG) Pipelines in Microservice Architectures
Retrieval-Augmented Generation (RAG) is increasingly adopted to ground large language model (LLM) responses in enterprise knowledge; however, production RAG backends often fail to meet stringent latency, reliability, and cost constraints under multi-tenant workloads. This paper presents a scalable, cost-efficient RAG reference architecture for enterprise backend systems, combining tiered retrieval, adaptive caching, and policy-driven guardrails. The approach decomposes RAG into microservices for ingestion, indexing, query orchestration, and evaluation, enabling independent scaling and fault isolation. To reduce spend and tail latency, we introduce (i) semantic and document-level caches with TTL and invalidation policies, (ii) dynamic routing across model tiers and retrieval depths based on SLO budgets, and (iii) hybrid search with metadata filters to constrain candidate sets prior to re-ranking. The design integrates observability using distributed tracing and cost telemetry to attribute token usage and retrieval overhead per request and tenant. We further outline governance controls for prompt injection resilience, data access enforcement, and auditability. Experimental evaluation on representative enterprise workloads demonstrates improved p95 latency and reduced token consumption while preserving answer faithfulness, indicating that SLO-driven orchestration is essential for reliable, economical RAG in production backends.
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2025-10-12
- DOI
- https://doi.org/10.5281/zenodo.17948225
- Primary Topic
- Software System Performance and Reliability
- Type
- article
- Field-Weighted Citation Impact
- 0.00