Enhancing Distributed Feedback Reporting in Milvus: Reliable ViewFeedback over Persistent Sync Streams
Why Reliable Feedback Reporting Matters in Distributed Systems
In distributed data systems like Milvus, accurate and timely feedback about shard accesses is crucial for efficient coordination and resource management. When feedback data is incomplete or outdated, components may make suboptimal decisions, leading to performance degradation or resource contention.
This article dives into a recent improvement in Milvus that tackles a subtle but impactful issue: reliably collecting and reporting ViewFeedback over persistent synchronization streams.
The Problem: Transient and Incomplete Feedback Data
Before this fix, Milvus's handling of ViewFeedback was prone to data loss and inconsistency. The system lacked a dedicated mechanism to track shard-level planning accesses and feedback windows across its components. As a result, the feedback data was transient - it existed only temporarily and was not consistently propagated or persisted.
This transient nature caused two main issues:
- Incomplete Metrics: Without persistent tracking, the shard access metrics were often outdated or missing, impairing the systemβs ability to understand recent usage patterns.
- Inefficient Coordination: Components like
StreamingNode,Syncer, andCoordinatorcould not reliably share or aggregate feedback data, leading to inefficiencies in synchronization and planning.
The Core Mechanism: Introducing Persistent and Efficient Feedback Handling
The solution involved a multi-component enhancement focusing on persistent, efficient, and coordinated feedback reporting.
StreamingNode: Dedicated Handler for Planning Accesses and Window Detachment
A new handler was added to the StreamingNode to collect planning accesses by ShardID. This handler periodically or size-triggered detaches feedback windows, ensuring that data is batched and sent out in manageable chunks. To avoid overwhelming the system, cooldowns regulate the frequency of these detachments.
This design ensures that feedback data is not just transient but is periodically captured and prepared for downstream consumption.
Syncer: Seeding Persistent Streams and Managing Bounded Feedback Batches
The Syncer component now seeds persistent synchronization streams using snapshots from the ChannelManager. This approach guarantees that the feedback stream starts from a well-defined, consistent state.
Moreover, Syncer manages feedback batches with bounded sizes to prevent unbounded memory growth. Importantly, it does this without replaying old feedback data, avoiding redundant processing and improving efficiency.
Coordinator: Maintaining Ordered Windows with Expiry and Immutable Snapshots
The Coordinator retains ordered feedback windows for a fixed period (2 minutes). This retention window allows it to revert expired counts, maintaining an accurate view of current shard access rates.
To facilitate efficient read-side operations, the Coordinator publishes immutable snapshots of the feedback data. This approach avoids expensive locking or copying, enabling fast and thread-safe access to metrics.
Efficient Rate Calculation and Aggregation
Request rates per shard are calculated precisely over the actual span of feedback windows. The aggregation is optimized to run in O(1) time, ensuring scalability even as the number of shards grows. This efficiency is critical for maintaining real-time metrics with minimal overhead.
Lessons Learned: Balancing Timeliness, Persistence, and Efficiency
Designing distributed feedback reporting mechanisms requires a careful balance:
- Timeliness: Feedback must be detached and reported promptly to remain relevant.
- Persistence: Data should be retained long enough to allow accurate aggregation but not so long as to waste resources.
- Efficiency: Aggregation and snapshotting must avoid costly operations like locking or copying to maintain system performance.
This Milvus enhancement exemplifies how thoughtful engineering can improve observability and coordination in complex distributed systems.
This article is based on a recent pull request merged into the milvus-io/milvus repository. Read the full breakdown on nossletter.tech. Originally published on Nossletter.
Comments
No comments yet. Start the discussion.