perf(server): add token cache diagnostics for issue #306 - #307
Closed
XiNian-dada wants to merge 1 commit into
Closed
perf(server): add token cache diagnostics for issue #306#307XiNian-dada wants to merge 1 commit into
XiNian-dada wants to merge 1 commit into
Conversation
Add instrumentation to measure token verification cache performance in reconnect storm scenarios: - Add token_cache_hits and token_cache_misses atomic counters to NodeRegistry - Track cache hits/misses in verify_hashed_token hot path - Add getter methods (test-only) for cache_hits, cache_misses, hit_rate - Add STORM_CACHE_STATS output in reconnect storm load test - Expose NodeRegistry through TestServer for diagnostic access Test results confirm cache is working correctly: - 75.00% hit rate achieved across all scenarios (20-200 nodes) - Registry revision remains stable (no token mutations during test) - Cache performance scales linearly with fleet size Diagnostic counters are test-only (#[cfg(test)]) to avoid exposing internal metrics in production API surface. Co-Authored-By: Claude <noreply@anthropic.com>
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add instrumentation to measure token verification cache performance in reconnect storm scenarios, confirming the cache is working correctly.
Changes
token_cache_hitsandtoken_cache_missesatomic counters toNodeRegistryverify_hashed_tokenhot pathcache_hits,cache_misses,hit_rateSTORM_CACHE_STATSoutput in reconnect storm load testNodeRegistrythroughTestServerfor diagnostic accessTest Results
Key Findings
Cache hit rate: 75% - Matches theoretical expectation:
Registry revision stability - Stays at 1 throughout test:
(token_hash, registry_revision)remains stableLinear scalability - Performance consistent across fleet sizes:
Conclusion
✅ Token verification cache is performing as designed
✅ No further optimization needed
✅ Diagnostic counters preserved for future investigations
Closes #306