Design an architecture for an enterprise GPT (a chat with an LLM and document uploads for RAG) for 5,000 users per week.
Asked at
AI answer
For 5,000 users per week, I wouldn’t choose capacity based only on the number of accounts: first, I’d estimate peak concurrency, requests per minute, document sizes, SLAs, and data residency requirements. The architecture can be divided into the following components:
- Web client and API gateway: authentication through corporate SSO, rate limiting, request routing, and access-control checks.
- Chat service: a stateless application behind a load balancer; conversation history and settings stored in a relational database. Stream responses using SSE or WebSocket.
- Document upload service: accepts files, validates their type and size, stores the originals in object storage, and enqueues a processing task. Asynchronous workers extract text, perform OCR if needed, clean and split the text into chunks, and generate embeddings.
- RAG search: a vector store with metadata and filtering by tenant, user, and ACL; hybrid vector and full-text search if needed. Permissions must be applied when retrieving candidates, not only afterward.
- Response orchestration: context and limit checks, retrieval, prompt assembly with the retrieved chunks, a call to a corporate or external LLM, and returning the response with citations. Use a queue for long-running tasks; regular chat is better handled synchronously with streaming output.
- Storage and operations: object storage for files, a database for users and metadata, a queue for background tasks, secrets in a secrets manager, metrics/logs/traces, and an audit trail of actions.
Services should run in Kubernetes with horizontal scaling based on CPU, memory, and application metrics such as queue length and the number of active requests. The external LLM and vector store should be treated as dependencies with timeouts, bounded retries, and a circuit breaker. Limits are needed for file size and count, along with token cost controls, encryption, retention policies, and data deletion. Load testing against expected peaks should be conducted before choosing the number of replicas and the database.
Also asked at Т1 Иннотех
- What enables the OpenSearch engine to return results quickly across a huge database (what algorithm is it based on)?
- How would you build a system for evaluating the quality of a RAG pipeline and agents, including comparing versions when chunking changes and finding facts without using LLM-as-a-judge?
- How are Recall and Precision metrics calculated in the context of document retrieval?
- How would you organize load testing for the designed service: what baseline scenarios, signs of degradation, and Kubernetes container metrics should be monitored?
- Give an example from your experience (resume) of a task similar to the asynchronous pipeline being designed.
Similar questions
- Tell me about the RAG system you implemented: what components did it consist of, and what led to the increase in conversion?
- How was the smart search based on RAG and MCP set up?
- From what you’ve described, most of it involved prompting. Have you worked with structured output or tool calling, or built RAG in-house?
- Give examples of deploying AI agents to production: what exactly did you do on your own or as part of a team?
- How did you design fallback logic for LLM or Redis failures?