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/10/13 11:27:48 UTC

[skywalking] branch master updated: Optimize the query time of tasks in ProfileTaskCache (#9780)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 32b0d362f2 Optimize the query time of tasks in ProfileTaskCache (#9780)
32b0d362f2 is described below

commit 32b0d362f2b790a735b192390d3f4346b652aaac
Author: xzyJavaX <49...@users.noreply.github.com>
AuthorDate: Thu Oct 13 19:27:26 2022 +0800

    Optimize the query time of tasks in ProfileTaskCache (#9780)
---
 docs/en/changes/changes.md                                        | 1 +
 .../apache/skywalking/oap/server/core/cache/ProfileTaskCache.java | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 52fc0841ca..6a8bd77354 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -60,6 +60,7 @@
   so that the requests sent to API server is predictable (~10 requests every `interval`, 3 minutes), and the requests count is constant
   regardless of the cluster's changes. However with this change SkyWalking can't react to the cluster changes in time, but the delay
   is acceptable in our case.
+* Optimize the query time of tasks in ProfileTaskCache.
 
 #### UI
 
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ProfileTaskCache.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ProfileTaskCache.java
index 4149f39b05..f3127d0984 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ProfileTaskCache.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/ProfileTaskCache.java
@@ -118,16 +118,16 @@ public class ProfileTaskCache implements Service {
     }
 
     /**
-     * use for every db query
+     * use for every db query, -5 start time
      */
     public long getCacheStartTimeBucket() {
-        return TimeBucket.getMinuteTimeBucket(System.currentTimeMillis());
+        return TimeBucket.getMinuteTimeBucket(System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(5));
     }
 
     /**
-     * use for every db query, +10 start time and +15 end time(because use task end time to search)
+     * use for every db query, +5 end time(because use task start time to search)
      */
     public long getCacheEndTimeBucket() {
-        return TimeBucket.getMinuteTimeBucket(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(25));
+        return TimeBucket.getMinuteTimeBucket(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5));
     }
 }