You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Performance: avoid reloading embedding model on every query in docs-agent API #63
server-https/app.py (and server/app.py) instantiate SentenceTransformer inside milvus_search() for every tool call. This causes avoidable latency and memory churn.
Problem
Current behavior:
Each request that triggers search_kubeflow_docs re-creates the embedding model.
Model load time dominates query latency under repeated traffic.
Expected behavior:
Embedding model should be initialized once per process and reused across queries. for low latency
Nice find. The MCP server in kagent-feast-mcp/mcp-server/server.py already handles this with a lazy _init() pattern where the model and client are globals that only initialize once.
Worth noting this isn't the only per-request cost. The main servers also do connections.connect() + disconnect() on every call ([#28]) and run collection.load() each time. So each search is paying three initialization penalties. The MCP server sidesteps all of them because MilvusClient handles connection and collection state internally.
Somewhat related: even after the search runs, the servers truncate content_text to 400 chars before the LLM sees it, even though the pipeline stored 2000 chars. Filed that separately as [#181]
Activity
feat(embedding-service): add centralized embedding microservice (ADR-…
feat(embedding-service): add centralized embedding microservice (ADR-…
feat(embedding-service): add centralized embedding microservice (ADR-…
feat(embedding-service): add centralized embedding microservice (ADR-…
Fix: Reuse preloaded SentenceTransformer instead of re-instantiating …
Fix: Use preloaded embedding model in milvus_search() (kubeflow#63)
fix/kubeflow#63-embedding-performance
JayDS22 commentedon Mar 27, 2026
Nice find. The MCP server in
kagent-feast-mcp/mcp-server/server.pyalready handles this with a lazy_init()pattern where the model and client are globals that only initialize once.Worth noting this isn't the only per-request cost. The main servers also do
connections.connect()+disconnect()on every call ([#28]) and runcollection.load()each time. So each search is paying three initialization penalties. The MCP server sidesteps all of them becauseMilvusClienthandles connection and collection state internally.Somewhat related: even after the search runs, the servers truncate
content_textto 400 chars before the LLM sees it, even though the pipeline stored 2000 chars. Filed that separately as [#181]chasecadet commentedon Nov 20, 2026
Thank you for reporting this!
We are closing pre-restructure issues targeting the legacy
server/,server-https/,manifests/,kagent-feast-mcp/, or in-processSentenceTransformerprototype code. In #207, #210, #233, #240, and #249,kubeflow/docs-agentmigrated to dedicated TEI (text-embeddings-inference), FastMCP (docs-agent-mcp/mcp-server/), shared modular KFP pipelines (docs-agent-mcp/pipelines/), and Helm charts (docs-agent-mcp/charts/).If you still observe an equivalent issue on the current
mainstack, please feel free to open a new issue using the current issue templates.