Sentinel Metrics is inaccurant in highly concurrent conditions , is it necessary to make accurant way?

velaa5lx  于 3个月前  发布在  其他
关注(0)|答案(5)|浏览(86)

Issue Description

Metrics is accurant in highly concurrent conditions
Type: feature request

Describe what feature you want

when reporting use "copy on right" way , or sliding windows use MVCC to store

Describe your initial design (if present)

Additional context

Add any other context or screenshots about the feature request here.

svujldwt

svujldwt1#

Hi, would you like to give a POC for this?

wqnecbli

wqnecbli2#

Each LeapArray node is a linked list, when the bucket is deprecated, it creates a history snapshot as its next node and then resets;when the request hits the bucket, it iterates through the linked list until a suitable one is found; it gets a slightly earlier time statistic data instead of getting the current statistic; the length of the linked list has a threadhold that can be configured.

hgqdbh6s

hgqdbh6s3#

Hi, would you like to give a POC for this?
Each LeapArray node is a linked list, when the bucket is deprecated, it creates a history snapshot as its next node and then resets;when the request hits the bucket, it iterates through the linked list until a suitable one is found; it gets a slightly earlier time statistic data instead of getting the current statistic; the length of the linked list has a threadhold that can be configured.

rwqw0loc

rwqw0loc4#

Looks cool! But I don't quite understand how this new data structure makes the metrics more accurate, I was wondering if you could provide some specific scenarios where the metrics are inaccurate and explain how this new data structure works in these scenarios. 🙋🙋🙋

ffscu2ro

ffscu2ro5#

Looks cool! But I don't quite understand how this new data structure makes the metrics more accurate, I was wondering if you could provide some specific scenarios where the metrics are inaccurate and explain how this new data structure works in these scenarios.

sorry , I may have misunderstood, when i read this code,
public Map<Long, MetricNode> metrics() {
// The fetch operation is thread-safe under a single-thread scheduler pool.
long currentTime = TimeUtil.currentTimeMillis();
currentTime = currentTime - currentTime % 1000;
Map<Long, MetricNode> metrics = new ConcurrentHashMap<>();
List nodesOfEverySecond = rollingCounterInMinute.details();
long newLastFetchTime = lastFetchTime;
// Iterate metrics of all resources, filter valid metrics (not-empty and up-to-date).
for (MetricNode node : nodesOfEverySecond) {
if (isNodeInTime(node, currentTime) && isValidMetricNode(node)) {
metrics.put(node.getTimestamp(), node);
newLastFetchTime = Math.max(newLastFetchTime, node.getTimestamp());
}
}
lastFetchTime = newLastFetchTime;

return metrics;
}

it`s taking metrics of every second of the past, and it seems to be no possible of concurrent reads and writes. i used to think it was conting the hole window

相关问题