Online Problem Troubleshooting — Series 1: Freq Rpc && IO && Global Lock
First published on Medium
Miluvs Online Problem Troubleshooting — Series 1: Freq Rpc && IO && Global Lock
Preface
This article documents a critical performance diagnostic process involving the Milvus DataCoord engine. The case originated from a massive production outage encountered by Salesforce, where the system suffered from Out-of-Memory (OOM) failures under high-concurrency workloads. By analyzing the complex interplay between Milvus global lock mechanisms and etcd metadata synchronization, I identified a fundamental architectural bottleneck. This case study illustrates the specialized expertise required to maintain the stability of Zilliz’s core vector database infrastructure at a global scale.
Introduction
FreqRpc refers to frequent triggering of RPC operations, which are necessary in certain situations.
IO includes network and disk IO, generally referring to system actions that are time-consuming or exhibit noticeable fluctuations.
Global lock is a system-level completely pessimistic concurrency control.
These three factors can have a significant impact on the performance and stability of the system. If these three factors are coincidentally combined due to the negligence of the code designers, it may lead to significant global effects or even system crashes. This article combines a troubleshooting process of an issue on GitHub to record typical scenarios and summarize reusable experiences.
Problem Scenario
Github issue link: https://github.com/milvus-io/milvus/issues/30905
This is an out-of-memory (OOM) problem encountered by the American customer Salesforce. The story is quite long, but the scenario is actually quite simple: Salesforce is writing a large number of tables randomly on its self-built Milvus cluster. When the concurrency of the writes is high, the memory of the dataCoord node surges and OOM occurs.
The memory usage of the dataCoord exhibits roller coaster-like fluctuations.
This phenomenon is extremely abnormal because the responsibility of the dataCoord is to manage metadata, not data. From the monitoring data shown in the figure, it is quite unusual for the memory of the dataCoord to accumulate to 10GB or more. This is clearly not a normal system state.
Capture pprof for memory analysis.
go tool pprof http://[ip]:9876/debug/pprof/heap
According to the principles of graphviz, “First finds Red, Second finds Big”. Please note that the screenshot displays inuse_space, which means memory that has been allocated and not yet released. From this, it can be inferred that nearly 800MB of memory was allocated through the RPC interface: DataCoord_Update_Channel_CheckPoint_Handler during the sample duration.
Under normal circumstances, once an RPC request is handled quickly and returned to the client, the heap memory held by the request should be released promptly. The occurrence of memory residency may be due to two reasons. First, there may be a memory leak, where the request is completed but the memory is not released. Second, even though there is no memory leak, the request may not have been completed.
To verify this hypothesis, we will take a closer look at the goroutines.
Opening the pprof for goroutines, we observed a thick red line continuously descending, with an edge weight as high as 372789! This indicates that loads of goroutines are stuck in the process and unable to complete.
Digging further into the stack traces, as shown in the image below, it’s evident that these routines are all blocked by mutex locks.
Combined with the code, it was found that this mutex is a global lock used to protect the meta, and operations for reading and writing meta require synchronized access to etcd. In the case of small but high-frequency writes to etcd, the preceding arriving requests are unable to complete in time, while subsequent requests are blocked by the global lock, causing the rpc request itself to fill up memory and eventually lead to OOMKilled.
Solution:
- Lock splitting: Split the global lock according to channels to prevent requests from different channels from blocking each other.
- Batched RPC requests: Combine individual rpc requests into batches and send them together. This not only reduces the occurrence of GC unfriendly situations like this case but also makes IO actions such as writing to S3 or etcd more stable.
Conclusion:
The issue investigated in this article is not a memory leak but rather a memory backup caused by the simultaneous effects of high-frequency rpc, global locks, and IO operations. This is a code design issue that should be discovered early in the coding or code review process.
— MrPresent-Han



