Troubleshooting Intermittent High Latency in RAG Chatbots

arjunssat · reddit · 2026-07-10

The author is troubleshooting an intermittent 4–5 minute latency issue in a production-grade RAG chatbot.

The tech stack includes FastAPI (Python), Amazon Bedrock, and PostgreSQL + pgvector, all deployed in the same AWS region. The FastAPI container runs on Kubernetes, while PostgreSQL is on EC2. The author has already optimized database indices, pgvector indices, connection pools, thread pools, and K8s HPA, yet extremely slow requests still occur sporadically.

Symptoms:

The author plans to add instrumentation to measure latency at each stage, focusing on isolating the bottleneck among DB retrieval, vector search, Bedrock calls, and response generation. They are also seeking further troubleshooting suggestions from the community.

Original post →

More from Infra

Infra channel →