|
1 | | -# VFBquery Performance Analysis |
| 1 | +# VFBquery Performance Test Results |
2 | 2 |
|
3 | | -**Analysis Date:** 2025-09-09 |
4 | | -**Git Commit:** 72c602f15edbf366806cf74524ae1c931f15a1ed |
| 3 | +**Test Date:** $(date -u '+%Y-%m-%d %H:%M:%S UTC') |
| 4 | +**Git Commit:** 8ff2eec7423afbdf1dc8773cf3e674b6bf9a98fe |
5 | 5 | **Branch:** dev |
6 | | - |
7 | | -## Executive Summary |
8 | | - |
9 | | -**Root Cause Identified:** The 125-second delay for FBbt_00003748 queries is caused by VFB_connect's **lookup cache initialization** on cold start, not by the actual query processing. |
| 6 | +**Workflow Run:** 17589292536 |
10 | 7 |
|
11 | 8 | ## Test Overview |
12 | 9 |
|
13 | 10 | This performance test measures the execution time of VFB term info queries for specific terms: |
14 | 11 |
|
15 | | -- **FBbt_00003748**: medulla (anatomical class) - experiences cold start cache initialization |
16 | | -- **VFB_00101567**: individual anatomy data - benefits from warm cache |
17 | | - |
18 | | -## Performance Analysis |
19 | | - |
20 | | -### Cold Start vs Warm Cache Performance |
21 | | - |
22 | | -| Scenario | FBbt_00003748 | VFB_00101567 | Notes | |
23 | | -|----------|---------------|---------------|--------| |
24 | | -| **Cold Start** (no cache) | 126.84s | ~125s | Initial lookup cache build | |
25 | | -| **Warm Cache** (cached) | 0.54s | 0.16s | Subsequent runs with cache | |
26 | | -| **Performance Test** | 125.07s | 0.16s | Matches cold start pattern | |
27 | | - |
28 | | -### Root Cause Analysis |
29 | | - |
30 | | -The 125-second delay is **NOT** a performance regression but rather VFB_connect's lookup cache initialization: |
31 | | - |
32 | | -1. **Cache Purpose**: VFB_connect builds a complete lookup table of all terms (classes, individuals, properties) for faster subsequent queries |
33 | | -2. **Cache Location**: `~/.venv/lib/python3.10/site-packages/vfb_connect/lookup_cache.pkl` |
34 | | -3. **Cache Validity**: 3 months (automatically rebuilds when stale) |
35 | | -4. **Trigger**: First query after cache expiry or in clean environment |
36 | | - |
37 | | -### Performance Breakdown |
38 | | - |
39 | | -The actual query components are fast: |
40 | | - |
41 | | -- **SOLR term lookup**: ~0.08s |
42 | | -- **Term info parsing**: ~0.05s |
43 | | -- **get_instances query**: ~1.4s |
44 | | -- **Results processing**: ~0.4s |
45 | | - |
46 | | -**Total actual processing time**: ~2s (vs 126s cache build) |
47 | | - |
48 | | -### Optimizations Available in VFB_connect |
49 | | - |
50 | | -VFB_connect (since 2024-08-16) includes several caching optimizations: |
51 | | - |
52 | | -1. **VFBTerm Object Cache**: Enable with `vfb._use_cache = True` |
53 | | -2. **Environment Control**: Set `VFB_CACHE_ENABLED=true` in CI |
54 | | -3. **Manual Cache Management**: Use `vfb.reload_lookup_cache()` for fresh data |
55 | | -4. **Timestamp-based Invalidation**: Automatic 3-month cache expiry |
| 12 | +- **FBbt_00003748**: mushroom body (anatomical class) |
| 13 | +- **VFB_00101567**: individual anatomy data |
56 | 14 |
|
57 | | -## Recommendations |
| 15 | +## Performance Thresholds |
58 | 16 |
|
59 | | -### For Development |
| 17 | +- Maximum single query time: 5 minutes (300 seconds) |
| 18 | +- Maximum total time for both queries: 7.5 minutes (450 seconds) |
60 | 19 |
|
61 | | -- **Accept the cold start cost** - it's a one-time initialization per environment |
62 | | -- **Use warm cache** for repeated development/testing |
63 | | -- **Enable VFBTerm caching** with `vfb._use_cache = True` for repeated queries |
| 20 | +## Test Results |
64 | 21 |
|
65 | | -### For Production/CI |
| 22 | +``` |
| 23 | +$(cat performance_test_output.log) |
| 24 | +``` |
66 | 25 |
|
67 | | -- **Pre-warm cache** in deployment scripts |
68 | | -- **Set `VFB_CACHE_ENABLED=true`** in environment |
69 | | -- **Monitor cache age** and refresh periodically |
70 | | -- **Consider cache persistence** across deployments |
| 26 | +## Summary |
71 | 27 |
|
72 | | -### Performance Thresholds |
| 28 | +✅ **Test Status**: Performance test completed |
73 | 29 |
|
74 | | -- Maximum single query time: 5 minutes (300 seconds) ✅ |
75 | | -- Maximum total time for both queries: 7.5 minutes (450 seconds) ✅ |
| 30 | +- **FBbt_00003748 Query Time**: 155.0068 seconds |
| 31 | +- **VFB_00101567 Query Time**: 0.2188 seconds |
| 32 | +- **Total Query Time**: 155.2256 seconds |
76 | 33 |
|
77 | | -**Status**: Current performance is within acceptable thresholds for cold start scenarios. |
| 34 | +🎉 **Result**: All performance thresholds met! |
78 | 35 |
|
79 | 36 | --- |
80 | | -*Analysis completed: 2025-09-09* |
81 | | -*VFB_connect cache optimization introduced: 2024-08-16* |
| 37 | +*Last updated: 2025-09-09 16:35:11 UTC* |
0 commit comments