技能 编程开发 OpenEvidence 性能优化指南

OpenEvidence 性能优化指南

v20260311
openevidence-performance-tuning
指导通过精简问题、动态缓存、连接池、批处理与监控等手段,提升 OpenEvidence 临床查询速度,确保响应及时覆盖临床场景。
获取技能
119 次下载
概览

OpenEvidence Performance Tuning

Table of Contents

Overview

Optimize OpenEvidence clinical query performance for point-of-care response times. Covers query optimization, intelligent caching with TTL management, connection pooling, request batching, and performance monitoring.

Prerequisites

  • OpenEvidence integration running
  • Monitoring configured (see openevidence-observability)
  • Redis for caching
  • Access to performance metrics

Performance Targets

Metric Target Critical
Clinical Query P50 < 3s > 10s
Clinical Query P95 < 8s > 15s
Cache Hit Rate > 70% < 50%
DeepConsult Start < 5s > 15s

Instructions

Step 1: Optimize Query Construction

Remove filler words from questions, limit context to top 5 conditions and 10 medications, set maxCitations: 5 for faster responses.

Step 2: Implement Intelligent Caching

Build ClinicalQueryCache with SHA-256 key generation. Use dynamic TTL: 5min for stat/urgent, 24hr for pharmacokinetics/mechanisms, 1hr for guidelines, default for others.

Step 3: Enable Connection Pooling

Configure HTTPS agent with keepAlive: true, 10 max sockets, 5 max free sockets. Pre-warm connections on startup.

Step 4: Set Up Request Batching

Use DataLoader to batch concurrent queries (max 5 per batch, 50ms scheduling window) within rate limits.

Step 5: Add Performance Monitoring

Instrument queries with Prometheus histograms for latency by specialty/urgency/cached, plus cache hit/miss counters.

Output

  • Optimized query construction
  • Intelligent caching with dynamic TTL management
  • Connection pooling with keep-alive
  • Request batching via DataLoader
  • Performance metrics and monitoring

Error Handling

Performance Issue Detection Resolution
High P95 latency Metrics alert Check cache hit rate, optimize queries
Low cache hit rate < 50% hits Review TTL strategy, check key normalization
Connection timeouts Timeout errors Check keep-alive config, increase pool size
Memory pressure Redis alerts Implement LRU eviction, reduce TTLs

Examples

Cache TTL Strategy

Stat/urgent queries:      5 minutes
Pharmacokinetics/mechanisms: 24 hours
Treatment guidelines:     1 hour
Default clinical queries: configurable (default 1hr)

See detailed implementation for advanced patterns.

Resources

信息
Category 编程开发
Name openevidence-performance-tuning
版本 v20260311
大小 2.94KB
更新时间 2026-03-12
语言