Event Loop Additional Metrics to make event-loop stalls more visible
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, observability-sre
Hướng nghiên cứu
Start by reading the Node.js event loop delay and utilization metric implementation and its tests to see how samples are currently recorded. Compare the proposed counters and delay measurement with the existing metrics, then determine whether the issue’s sampling assumptions fit the implementation. Done means agreeing on the metric definitions and adding metrics with tests that demonstrate their behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is the problem this feature will solve?
Hey!
This feature will help with more precise detection of long-running tasks in Node.js event loop.
When calculating p99, it will help make long event-loop stalls more visible
What is the feature you are proposing to solve the problem?
My proposal is to add additional metrics like:
- exceededIntervalCounter / okIntervalCounter
- to calculate ratio between both of them
- exceededIntervalDelay
Thanks to them, it would be easier to detect event-loop stalls.
Cause ok samples and exceeded samples are treated separately.
Before going further let me first explain current metrics, to be sure, that my understanding is correct.
Cause maybe there is something, I still don't understand well and this issue doesn't make sense.
Note: During issue I'm writing typically about task duration. But I'm aware that more precise interpretation is event loop probe delay.
Event Loop Utilisation
My understanding of Event Loop Utilization (ELU) is:
- ELU isn't aware about task duration
- ELU is similar to CPU utilization, but it's not CPU utilization
- ELU like 85% may mean:
- there is a problem with event loop
- there is no problem with event loop, all tasks are short and event loop is healthy
- ELU is great to detect skew in node.js cluster mode
- worker1: ELU 20%
- worker2: ELU 15%
- worker3: ELU 85% - probably something wrong with this worker
Event Loop Delay
My understanding of Event Loop Delay (ELD) is:
- when calculating
p99- it can be low, because a lot of short tasks can hide long tasks
maxis always helpful- it's rather like: catastrophe detector
Code looks like this:
function monitorSample(diffNanos) {
delay.observe(diffNanos / 1e9);
// delay.observe((diffNanos - intervalNanos ) / 1e9); i'm not sure
}
About those metrics:
- exceededIntervalCounter
- exceededIntervalDelay
My understanding of those Event Loop those metrics is:
- exceededIntervalCounter ( together with okIntervalCounter )
- how often event loop was doing tasks longer than interval?
- to be more precise: how often probe wasn't able to execute?
okIntervalCounteris needed to calculate ratioexceededRatio = exceededIntervalCounter / (okIntervalCounter + exceededIntervalCounter)
- how often event loop was doing tasks longer than interval?
- exceededIntervalDelay
- if probe wasn't able to execute, how long it was delayed?
Let's assume interval 10ms to describe event loop status:
- event loop idle or tasks below 10ms
- always healthy sample
- task between 10ms and 20ms - healthy or unhealthy sample
- cause we don't know when task started
- task higher than 20ms
- always unhealthy sample
Code could look like this:
function monitorSample(diffNanos) {
const lagNanos = Math.max(0, diffNanos - intervalNanos - intervalNanos);
if (lagNanos > 0) {
const missedSamples = Math.floor(diffNanos / intervalNanos);
exceededCounter.inc(missedSamples);
exceededHistogram.observe(lagNanos / 1e9);
} else {
okCounter.inc();
}
}
The best part in all of that
- all of those metrics still do not directly measure end-user latency
- splitting one big task into smaller tasks may cause tasks overlap
- from logical point of view, there is a lot of concurrent cpu tasks
- so higher response times during day, faster during night, may suggest, that tasks are overlapping
- healthy event loop metric won't tell anything about that
What alternatives have you considered?
Just use current Event Loop Utilization and Event Loop Delay metrics.
I'm open to your feedback!
- Ngôn ngữ chính
- JavaScript
- Star
- 124k
- Fork
- 38k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 266
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fs: document readStream.start and readStream.endCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdoc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
nodejs/node#67848 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
doc: document the Buffer.prototype.*Slice() methodsCó thể đã có người làm @AyushCipher đã nhận hôm nay. Đang mởdoc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
nodejs/node#67847 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`styleText` fast path bypasses `options` and `options.validateStream` validationCó thể đã có người làm @GBra-4-669 đã nhận 8 ngày trước. Đang mởutil
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
riscv64
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nodejs/node#67655 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
bug triage needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Resource]: PersephoneĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
hesreallyhim/awesome-claude-code#3773 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
tabatkins/railroad-diagrams#129 ·
-
web: api() turns a null or object-valued error body into a TypeError or "[object Object]" and loses the statusCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
OCM: shares using the `embedded` protocol are rejected with "Missing sharedSecret in protocol"Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày