Practical Solutions to Improve Base Chat's Multi-Tenant Performance
Optimizing Base Chat performance in multi-tenant scenarios can be approached from both architectural and configuration perspectives:
- Database Optimization
- Create separate Schema for different tenants for data segregation
- Add a created_at time index to the frequently queried chat logs table.
- Perform regular VACUUM and ANALYZE to maintain database performance - Architecture Optimization
- Manage database connections using connection pooling (pgBouncer recommended)
- Enable Redis caching layer for non-real-time data queries
- Implementation of a tenant-level request flow limitation mechanism - Configuration optimization
- Tweaking the ISR (Incremental Static Regeneration) policy for Next.js
- Optimizing Ragie Connect's Bulk Request Size Parameter
- Monitor API response time for each tenant and target optimization
Implementation of recommendations:
1. first in the staging environment using PostgreSQL's EXPLAIN ANALYZE analysis of slow queries
2. When deployed in PM2 cluster mode, the number of instances can be set to 2-3 times the number of CPU cores.
3. Critical tenants may consider dedicated database instances
This answer comes from the articleBase Chat: A Multi-Tenant Chatbot for Building Knowledge Bases Based on RagieThe




























