Назад к подготовке

Вопрос про production ML

For a FastAPI-backed LLM product, when would you use Postgres, ClickHouse and Redis?

Ответить самому

Сначала сформулируйте ответ как на собеседовании, затем откройте разбор и оцените себя.

Загрузка

Короткий ответ

Use Postgres for transactional product state, ClickHouse for analytical event/log queries, and Redis for low-latency cache, sessions, rate limits or queues.

Полный разбор

Postgres is the default for durable transactional state: users, projects, permissions, prompt templates, job metadata and relational business objects. It gives constraints, migrations, transactions and mature operational tooling.

ClickHouse is useful when the product emits high-volume analytical events: LLM request logs, token usage, latency, feedback, evaluation traces and aggregate dashboards. It is optimized for append-heavy columnar scans, not transactional updates.

Redis is for low-latency ephemeral state: caching model/config lookups, rate limits, sessions, short-lived queues, locks or streaming coordination. Do not use Redis as the only durable source for data that must survive restarts unless you deliberately configure persistence and accept the trade-offs.