Lessons › From one user to millions
Ask in plain words
Your help centre gets 1,000 req/s, and 5% are people asking questions in their own words: 50 a second. Keyword search can't match "my card got eaten" to the article on failed payments.
Play this levelFree with an account. It runs in your browser: build the design, press Run, and watch what breaks.
The lesson
A vector database stores each article as a list of numbers that captures its meaning. Similar meanings end up close together, so a question finds the right article even with no words in common.
A model then reads the articles it found and writes the answer. This pattern is called RAG: search first, then ask, so the model works from your documents instead of guessing.
Model calls are the slowest and priciest step you've met. Two seconds is a normal wait, and your provider limits calls per minute. Each step here is about 1,000 calls a minute, so about 17 a second.
Benchmarks for vectors are measured at a set accuracy: 1,413 searches a second at 95.6% recall on 4 vCPUs. Ask for higher accuracy and you get fewer.
What you have to achieve
1,000 requests a second at the busiest hour, 2% of them writes.
- No broken or illegal connections
- Use a Vector DB with at least 2 instances
- Use an LLM API
- No component is overloaded
- No single point of failure
- Fewer than 0.1% of requests fail
- p99 response time under 4 s
What you learn
Look at the bill: the LLM tokens cost more than your whole design. Every question costs real money, so people cache answers and use smaller models for simple ones. A 2 second answer is also why these products stream the text as it's written.
Check yourself
How does a vector database find an article with no words in common?
- It guesses
- It searches every word's synonyms
- It stores meaning as numbers, and similar meanings sit close together
Show the answer
It stores meaning as numbers, and similar meanings sit close together. Each article becomes a list of numbers. A question finds the nearest ones by meaning.
What does RAG mean in practice?
- Search your documents first, then the model answers from them
- Train a new model
- Cache every answer
Show the answer
Search your documents first, then the model answers from them. The model works from what you found instead of guessing. That's retrieval augmented generation.