NOSSLETTER.techLIVE
back to archive

enhance: pipeline index builds with ordered resource admission

Language: Go+4637 -598feature
concepts demonstrated
FIFO queue managementConcurrency with overlapping tasksMemory-backed I/OConditional compilation with build tags
The Issue & Context

Previously, vector index builds in Milvus were processed serially without overlapping download, build, and upload phases, leading to underutilized resources and longer overall build times, especially under concurrent workloads.

Root Cause Analysis

The old system lacked a coordinated resource admission mechanism to manage concurrent vector build tasks, causing each build to hold exclusive resources from download through upload. This serialized execution was enforced by the VectorDiskBuildFileManager and related components without accounting for queued tasks or overlapping I/O and computation.

Solution Strategy & Architectural Pattern

This PR introduces a FIFO admission queue for vector builds that reserves backend resources from download through upload and cleanup phases, enabling overlap of vector index download, build, and upload. It uses memory-backed vector I/O and asynchronous byte-based downloads with parallel copies to maximize throughput. Admission logic now accounts for queued tasks and excludes admission wait time from build latency metrics. Scalar index builds and stats tasks can run independently, improving overall concurrency. The VectorDiskBuildFileManager and related classes were refactored to implement this ordered resource reservation and overlapping pipeline.

Key Takeaway for Contributors

When managing resource-intensive, multi-phase tasks in a concurrent system, implementing a FIFO admission queue with explicit resource reservations enables safe overlapping of I/O and compute phases, improving throughput without risking resource contention or starvation.