Redis host cache optimizations - #46458
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #46458 +/- ##
==========================================
- Coverage 66.82% 66.81% -0.02%
==========================================
Files 2808 2799 -9
Lines 223582 223554 -28
Branches 11347 11332 -15
==========================================
- Hits 149413 149358 -55
- Misses 60615 60643 +28
+ Partials 13554 13553 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
@lucasmrod Additional Redis host cache improvements for review, after recent 4.86 loadtest. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis PR increases the default Redis host-cache TTL from 60 seconds to 180 seconds, reducing cache repopulation overhead. It also optimizes the UpdateHost invalidation path to delete host-cache entries using direct key construction instead of reverse-index lookups, eliminating redundant GETs to the database. The changes include configuration updates, documentation adjustments, and test coverage for edge cases where either NodeKey or OrbitNodeKey may be absent. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR reduces database reader load and Redis CPU usage for the Redis-backed host-by-node_key/orbit_node_key cache by extending the default TTL window and cutting Redis commands on common invalidation paths.
Changes:
- Increased the default
redis.host_cache_ttlfrom 60s to 180s (with existing jitter) to reduce cache repopulation frequency. - Optimized the
UpdateHost/SerialUpdateHostinvalidation path to delete known cache keys directly instead of doing reverse-index GETs. - Added/expanded automated tests covering the updated invalidation behavior.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/datastore/mysqlredis/host_cache.go | Updates TTL/jitter documentation to reflect the new 180s default and expected hit rate. |
| server/datastore/mysqlredis/host_cache_writes.go | Implements direct-key invalidation for host updates to reduce Redis command count. |
| server/datastore/mysqlredis/host_cache_writes_test.go | Adds tests for update-path invalidation variants (osquery-only, sparse host fallback). |
| server/config/config.go | Changes the default config value for redis.host_cache_ttl to 180s. |
| changes/46338-host-cache-ttl-and-invalidation | Release note describing the TTL increase and invalidation optimization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related issue: Resolves #46338
Changes load tested (osquery load test).


Checklist for submitter
changes/,orbit/changes/oree/fleetd-chrome/changes.Testing
Summary by CodeRabbit
Performance Improvements
Tests