You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/12/05 09:54:15 UTC
[skywalking] 01/01: Remove offset of metrics session threshold. Try to correct SessionCacheCallback
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch fix
in repository https://gitbox.apache.org/repos/asf/skywalking.git
commit ff7fe4d46eef49726c2ac35c586a7d19adf68ab4
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Mon Dec 5 17:53:58 2022 +0800
Remove offset of metrics session threshold. Try to correct SessionCacheCallback
---
docs/en/changes/changes.md | 1 +
.../server/core/analysis/worker/MetricsPersistentWorker.java | 10 +---------
.../oap/server/core/storage/SessionCacheCallback.java | 10 ----------
3 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index bf96fcabe7..e31225a95d 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -21,6 +21,7 @@
// for the specific minute of booted successfully, the metrics are expected to load from database when
// it doesn't exist in the cache.
```
+* Remove offset of metrics session threshold. Only keep 4 times of minute dimensionality timeout.
#### UI
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java
index 403e2b8c67..dee1994040 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java
@@ -53,11 +53,6 @@ import org.apache.skywalking.oap.server.telemetry.api.MetricsTag;
*/
@Slf4j
public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
- /**
- * The counter of MetricsPersistentWorker instance, to calculate session timeout offset.
- */
- private static long SESSION_TIMEOUT_OFFSITE_COUNTER = 0;
-
private final Model model;
private final MetricsSessionCache sessionCache;
private final IMetricsDAO metricsDAO;
@@ -157,7 +152,6 @@ public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
"metrics_persistent_cache", "The counter of metrics status, new or cached.",
new MetricsTag.Keys("status"), new MetricsTag.Values("cached")
);
- SESSION_TIMEOUT_OFFSITE_COUNTER++;
serverStatusService = moduleDefineHolder.find(CoreModule.NAME).provider().getService(ServerStatusService.class);
}
@@ -176,9 +170,7 @@ public class MetricsPersistentWorker extends PersistenceWorker<Metrics> {
supportUpdate, storageSessionTimeout, metricsDataTTL, kind
);
// For a down-sampling metrics, we prolong the session timeout for 4 times, nearly 5 minutes.
- // And add offset according to worker creation sequence, to avoid context clear overlap,
- // eventually optimize load of IDs reading.
- sessionCache.setTimeoutThreshold(storageSessionTimeout * 4 + SESSION_TIMEOUT_OFFSITE_COUNTER * 200);
+ sessionCache.setTimeoutThreshold(storageSessionTimeout * 4);
// The down sampling level worker executes every 4 periods.
this.persistentMod = 4;
}
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java
index ceff064e05..98e01bf87c 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java
@@ -29,22 +29,12 @@ import org.apache.skywalking.oap.server.core.analysis.worker.MetricsSessionCache
public class SessionCacheCallback {
private final MetricsSessionCache sessionCache;
private final Metrics metrics;
- /**
- * In some cases, this callback could be shared by multiple executions, such as SQLExecutor#additionalSQLs.
- * This flag would make sure, once one of the generated executions is failure, the whole metric would be removed
- * from the cache, and would not be added back. As those are executed in a batch mode. The sequence is uncertain.
- */
- private volatile boolean isFailed = false;
public void onInsertCompleted() {
- if (isFailed) {
- return;
- }
sessionCache.put(metrics);
}
public void onUpdateFailure() {
- isFailed = true;
sessionCache.remove(metrics);
}
}