juncevich opened a new pull request, #7708:
URL: https://github.com/apache/ozone/pull/7708

   ## What changes were proposed in this pull request?
   Change synchronized metrics collect methods to read/write lock 
implementation.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-9377
   
   ## How was this patch tested?
   I wrote the JUnit test (I'm not sure I should add this test to this PR) to 
compare performance metric realization.
   
   ```
     @RepeatedTest(100)
     void testMyMetrics() throws InterruptedException {
       OzoneMutableRate rate = new OzoneMutableRate("Test name", "Test 
description", true);
       final MetricsRecordBuilder builder = getMetricsRecordBuilder();
       ExecutorService executor = Executors.newFixedThreadPool(10);
       for (int i = 0; i < 100; i++) {
         int finalI = i;
   
         executor.submit(() -> {
           rate.add(finalI);
           if (finalI % 100 == 0) {
             rate.snapshot(getMetricsRecordBuilder());
           }
         });
       }
       executor.awaitTermination(1, TimeUnit.SECONDS);
       rate.snapshot(builder);
       assertEquals(100, builder.metrics().get(0).value().intValue());
     }
   ```
   


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