aweisberg commented on code in PR #3068:
URL: https://github.com/apache/cassandra/pull/3068#discussion_r1476237255


##########
src/java/org/apache/cassandra/metrics/CassandraMetricsRegistry.java:
##########
@@ -250,6 +271,43 @@ private void removeAlias(MetricName name)
         if (mBeanServer.isRegistered(name.getMBeanName()))
             MBeanWrapper.instance.unregisterMBean(name.getMBeanName(), 
MBeanWrapper.OnException.IGNORE);
     }
+
+    /**
+     * Very infrequently used meters generate a linear amount of tick work 
based on how long it has been
+     * since the meter was last marked or read. On scales of a year this can 
be enough to cause the first request
+     * that needs to mark the meter to time out. Once a day read every meter 
to force them to run Meter.tickIfNecessary
+     * so we only ever run at most one day worth of tick work per meter in the 
request path.
+     *
+     * This can be removed if we ever upgrade and switch the default 
MovingAverage from EWMA to SlidingWindowTimeAverages
+     */
+    private void tickMeters()
+    {
+        List<Throwable> failures = new ArrayList<>();
+        int droppedFailures = 0;
+        for (Meter meter : getMeters().values())

Review Comment:
   This gets called once a day in a background thread. Assume 100 meters per 
table and 1000 tables it takes about 26 seconds on my laptop. This is to 
process a days worth of ticks on every meter as if it were unused.
   
   So maybe `0.00003761574` of daily CPU time on an 8 core server. The time is 
dominated by actually ticking not iterating the metrics.
   
   I really don't think it's worth the extra lines of code to make iteration 
faster.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to