You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "songxiaosheng (via GitHub)" <gi...@apache.org> on 2023/02/22 14:35:12 UTC

[GitHub] [dubbo] songxiaosheng commented on a diff in pull request #11628: Metrics RT count optimization

songxiaosheng commented on code in PR #11628:
URL: https://github.com/apache/dubbo/pull/11628#discussion_r1114409890


##########
dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/collector/sample/SimpleMetricsCountSampler.java:
##########
@@ -38,124 +43,120 @@
 public abstract class SimpleMetricsCountSampler<S, K, M extends Metric>
     implements MetricsCountSampler<S, K, M> {
 
-    private final ConcurrentMap<M, AtomicLong>      lastRT = new ConcurrentHashMap<>();
-    private final ConcurrentMap<M, LongAccumulator> minRT  = new ConcurrentHashMap<>();
-    private final ConcurrentMap<M, LongAccumulator> maxRT  = new ConcurrentHashMap<>();
-    private final ConcurrentMap<M, AtomicLong>      avgRT   = new ConcurrentHashMap<>();
-    private final ConcurrentMap<M, AtomicLong>      totalRT = new ConcurrentHashMap<>();
-    private final ConcurrentMap<M, AtomicLong>      rtCount = new ConcurrentHashMap<>();
+    private final ConcurrentMap<M, AtomicLong> EMPTY_COUNT = new ConcurrentHashMap<>();
 
-    private Map<K, ConcurrentMap<M, AtomicLong>> metricCounter = new ConcurrentHashMap<>();
+    private final ConcurrentMap<M, LongAccumulator> minRT = new ConcurrentHashMap<>();
+    private final ConcurrentMap<M, LongAccumulator> maxRT = new ConcurrentHashMap<>();
+
+    // lastRT, totalRT, rtCount, avgRT share a container, can utilize the system cache line
+    private final ConcurrentMap<M, AtomicLongArray> RTArray = new ConcurrentHashMap<>();

Review Comment:
   Please change the first name to lowercase



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org