Asthenia0412 opened a new pull request, #67945:
URL: https://github.com/apache/doris/pull/67945

   [fix](be) Avoid per-fd stat when counting process fds in metrics
   
   ### What problem does this PR solve?
   
   Issue Number: close #67777
   
   Problem Summary: `DorisMetrics::_update_process_fd_num()` counts entries 
under `/proc/self/fd` with `entry.is_regular_file()`, which follows every 
symlink with a `stat()` syscall. With ~200k open fds this takes ~0.6s per run, 
and the hook runs under the `MetricRegistry` lock every 15 s, stalling 
`/metrics` scrapes for hundreds of milliseconds. This PR counts the directory 
entries directly (readdir only), which is about 5x cheaper while still 
reflecting the number of open fds. The remaining stalls (hooks running under 
the registry lock, stream load blocking webserver workers) are tracked as 
follow-ups.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test: No need to test (with reason) - behavior preserved (fd count), only 
the per-entry stat syscalls are removed
   - Behavior changed: No
   - Does this need documentation: No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to