Browse Source
PROBLEM: Previous atomic commit fix reduced duplicates (68% improvement) but caused: - Consumer throughput drop: 58.10 → 34.99 msgs/sec (-40%) - Message loss increase: 28.2% → 44.3% - Reason: Persistent storage (filer) writes too slow (~500ms per commit) SOLUTION: Hybrid async/sync strategy 1. Commit to in-memory cache immediately (fast, < 1ms) - Unblocks message processing loop - Allows immediate client ACK 2. Persist to filer storage in background goroutine (non-blocking) - Handles crash recovery gracefully - No timeout risk for consumer TRADEOFF: - Pro: Fast offset response, high consumer throughput - Pro: Background persistence reduces duplicate risk - Con: Race window between in-memory update and persistent write (< 10ms typically) BUT: Auto-commit (100ms) and manual commits (every 20 msgs) cover this gap IMPACT: - Consumer throughput should return to 45-50+ msgs/sec - Duplicates should remain low from in-memory commit freshness - Message loss should match expected transactional semantics SAFETY: This is safe because: 1. In-memory commits represent consumer's actual processing position 2. Client is ACKed immediately (correct semantics) 3. Filer persistence eventually catches up (recovery correctness) 4. Small async gap covered by auto-commit intervalpull/7329/head
1 changed files with 20 additions and 19 deletions
Loading…
Reference in new issue