perf: Redis pub/sub, PgBouncer, optimistic UI for high concurrency
- Add Redis 7 for pub/sub (lobby + chat real-time), rate limiting, caching - Replace SSE DB polling with Redis pub/sub (lobby: instant approval, chat: instant delivery) - Add PgBouncer (transaction mode, 500 client → 25 pool connections) - Chat SSE stream via Redis pub/sub instead of 3s polling - Optimistic UI in ChatPanel (messages appear before server confirms) - Redis-based rate limiter (works across multiple app replicas) - Prisma query optimization (select only needed fields) - Chat message cache in Redis (10s TTL) - Docker Compose: add redis, pgbouncer services with healthchecks - Production: resource limits, 2 app replicas behind Traefik - Update CLAUDE.md, README.md, .env.example, setup.sh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
- **Backend:** Next.js Route Handlers, `livekit-server-sdk`
|
||||
- **Auth:** `better-auth` + Prisma adapter
|
||||
- **AI Agent:** Python, `livekit-agents`, Deepgram STT, OpenAI GPT
|
||||
- **DB:** PostgreSQL + Prisma 7
|
||||
- **DB:** PostgreSQL + Prisma 7 + PgBouncer (connection pooling)
|
||||
- **Cache/PubSub:** Redis 7 (real-time chat, lobby, rate limiting)
|
||||
- **Storage:** MinIO (S3-compatible)
|
||||
- **Proxy:** Traefik v3 + Let's Encrypt (production)
|
||||
|
||||
@@ -53,10 +54,10 @@ cp .env.example .env
|
||||
### 3. Запустить базу данных
|
||||
|
||||
```bash
|
||||
docker compose up -d postgres minio
|
||||
docker compose up -d postgres minio redis
|
||||
```
|
||||
|
||||
Поднимет PostgreSQL на `localhost:5432` и MinIO на `localhost:9000` (консоль: `localhost:9001`).
|
||||
Поднимет PostgreSQL (`localhost:5432`), MinIO (`localhost:9000`, консоль: `9001`), Redis (`localhost:6379`), PgBouncer (`localhost:6432`).
|
||||
|
||||
### 4. Применить миграции
|
||||
|
||||
|
||||
Reference in New Issue
Block a user