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

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

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


##########
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:
   Already fixed



-- 
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