activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franz1981 <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #1605: ARTEMIS-1476 HdrHistogram support on ve...
Date Tue, 24 Oct 2017 04:17:48 GMT
Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1605#discussion_r146450033
  
    --- Diff: artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/util/SyncCalculation.java
---
    @@ -69,74 +171,55 @@ public static long syncTest(File datafolder,
     
              file.close();
     
    -         long[] result = new long[tries];
    +         final long[] elapsedMillis = new long[tries];
     
    -         byte[] block = new byte[blockSize];
    -
    -         for (int i = 0; i < block.length; i++) {
    -            block[i] = (byte) 't';
    -         }
    -
    -         ByteBuffer bufferBlock = factory.newBuffer(blockSize);
    -         bufferBlock.put(block);
    -         bufferBlock.position(0);
    -
    -         final ReusableLatch latch = new ReusableLatch(0);
    -
    -         IOCallback callback = new IOCallback() {
    -            @Override
    -            public void done() {
    -               latch.countDown();
    -            }
    -
    -            @Override
    -            public void onError(int errorCode, String errorMessage) {
    -
    -            }
    -         };
    -
    -         DecimalFormat dcformat = new DecimalFormat("###.##");
    +         final DecimalFormat dcformat = new DecimalFormat("###.##");
              for (int ntry = 0; ntry < tries; ntry++) {
     
    +            //perform a gc on each test iteration to help cleanup of callbacks/garbage
    +            System.gc();
    --- End diff --
    
    Good point, I'm addressing all these things, but I need feedback on that too :)
    I see 2 options here:
    1) preallocate and cache the `blocks` IO callbacks (but could be a large number too) in
order to be garbage free again
    2) let the IO callbacks to size the (young) GC regions in the first test but uses a better
way (ie more reliable) to be sure GC won't affect the measurements
    
    I'm pushing the second solution right now, using the code used by the official microbenchmark
tool of the OpenJDK JMH (http://hg.openjdk.java.net/code-tools/jmh/file/e96cad1fc480/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java#l309)
to perform reliable GC, but feel free to give me feedbacks and suggest me to try the first
one too, although I'm not 100% sure could be a better way (cachin a large number of instances
in not optimal!!).



---

Mime
View raw message