perf: Round 2 — Remove poll loop, fire-and-forget with retry, mtime skip-early, combined Redis FCALL#1
Merged
Conversation
…ime+size skip-early, combined Redis FCALL, HMGET 1. Remove poll_process_status from sync pipeline entirely — fire-and-forget uploads skip the 2-second poll loop, attach to KB immediately 2. Retry list pattern: failed background attaches are collected and retried at the end of Phase 1 (Phase 1b), ensuring no files are silently dropped 3. mtime+size skip-early: check file metadata before hashing — if mtime and size match Redis, skip without reading the file (100x faster re-syncs) 4. Combined check_and_compare Lua FCALL: single Redis round-trip replaces separate check_file_exists + verify_file_hash calls (2-3x Redis speedup) 5. HMGET for Context Manager: single HMGET per key instead of 2 HGETs (2x) 6. Default max_concurrent_uploads raised from 5 to 20 7. upsert_sync_state now stores file_mtime and file_size in Redis
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
Major performance overhaul targeting the sync pipeline bottleneck identified via production Proxmox metrics (CPU 0.4%, IO 0.36% — hardware idle while sync took hours).
Changes
1. Remove poll_process_status (10-50x)
Eliminated the 2-second sleep poll loop entirely. Uploads now fire-and-forget: upload → attach to KB immediately.
2. Retry List Pattern
Failed background attaches are collected into a shared retry list and retried at the end of sync (Phase 1b).
3. mtime + size Skip-Early (100x re-syncs)
Check file metadata before hashing. If both match Redis, skip without reading the file.
4. Combined Redis FCALL (2-3x Redis)
New Lua 'check_and_compare' replaces separate check + verify calls. Single round-trip.
5. HMGET for Context Manager (2x)
Single HMGET per key instead of 2 HGETs.
Estimated Impact (13K files)
All 57 tests pass.