SIGN IN SIGN UP
milvus-io / milvus UNCLAIMED

Milvus is a high-performance, cloud-native vector database built for scalable vector ANN search

0 0 147 Go

enhance: add named C++ thread active metrics (#50064)

This PR adds lightweight active thread observability for named C++
thread pools.

- name FileWriteWorkerPool threads with the `MILVUS_FL_WR_` prefix
- sample named OS threads every 5 seconds and export
`milvus_thread_cpu_active_num_by_pool`
- classify active named threads by CPU-time delta or
runnable/uninterruptible state
- show active named C++ thread pools in the Runtime / OS Threads Grafana
panel by `pod` and `thread_pool`
- skip `/proc/self/task` collection on non-Linux platforms

issue: #50066

Performance note for the named thread active sampler:

I measured the cost of one sampling round by creating 128 / 512 / 1024
OS threads and repeatedly running the same `/proc/self/task` based
collection path. Each benchmark was run in a separate `go test` process
for 10 rounds to avoid OS-thread reuse affecting the result.

- Idle: about 2.1 ms for 128 threads, 7.9 ms for 512 threads, and 16.0
ms for 1024 threads per sampling round.
- Under 64 concurrent search workload: about 5.1 ms for 128 threads,
18.3 ms for 512 threads, and 34.1 ms for 1024 threads per sampling
round.

The sampler runs every 5 seconds, so even the 1024-thread case under
search load is about 34 ms / 5000 ms, or below 0.7% of one CPU core. The
current standalone test process had around 116 OS threads, closer to the
128-thread case. Based on this, the expected runtime overhead is low.

Signed-off-by: CLiQing <2208529306@qq.com>
C
ChenLiqing committed
50aca58ad2622aa8665c463f30f0a08256e9639d
Parent: b6a7af0
Committed by GitHub <noreply@github.com> on 5/28/2026, 2:10:15 AM