]> source.dussan.org Git - sonarqube.git/commitdiff
Issue/sourceline indexing is faster - adjust timeouts
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 19 Mar 2015 23:06:13 +0000 (00:06 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 19 Mar 2015 23:06:13 +0000 (00:06 +0100)
server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java

index 8abfd3d18d702e4567eb4d5a784bb1ce28c1628e..ded7df36c5c45b2b84970839a810792de6e68c5a 100644 (file)
@@ -112,10 +112,10 @@ public class IssueIndexBenchmarkTest {
     long period = System.currentTimeMillis() - start;
     long throughputPerSecond = 1000 * issues.count.get() / period;
     LOGGER.info(String.format("%d issues indexed in %d ms (%d docs/second)", issues.count.get(), period, throughputPerSecond));
-    benchmark.expectAround("Throughput to index issues", throughputPerSecond, 3400, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
+    benchmark.expectAround("Throughput to index issues", throughputPerSecond, 5116, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
 
     // be sure that physical files do not evolve during estimation of size
-    tester.get(EsClient.class).prepareOptimize("issues").get();
+    tester.get(EsClient.class).prepareOptimize("issues").setWaitForMerge(true).get();
     long dirSize = FileUtils.sizeOfDirectory(tester.getEsServerHolder().getHomeDir());
     LOGGER.info(String.format("ES dir: " + FileUtils.byteCountToDisplaySize(dirSize)));
     benchmark.expectBetween("ES dir size (b)", dirSize, 200L * FileUtils.ONE_MB, 420L * FileUtils.ONE_MB);
index 1c552af441c6832d8490edee6d5617ebf8badadc..ba6c4c0f2360e48d918d35b6f53c0882afa8081b 100644 (file)
@@ -81,10 +81,10 @@ public class SourceIndexBenchmarkTest {
     long nbLines = files.count.get() * LINES_PER_FILE;
     long throughputPerSecond = 1000L * nbLines / period;
     LOGGER.info(String.format("%d lines indexed in %d ms (%d docs/second)", nbLines, period, throughputPerSecond));
-    benchmark.expectAround("Throughput to index source lines", throughputPerSecond, 7800, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
+    benchmark.expectAround("Throughput to index source lines", throughputPerSecond, 8950, Benchmark.DEFAULT_ERROR_MARGIN_PERCENTS);
 
     // be sure that physical files do not evolve during estimation of size
-    tester.get(EsClient.class).prepareOptimize(SourceLineIndexDefinition.INDEX).get();
+    tester.get(EsClient.class).prepareOptimize(SourceLineIndexDefinition.INDEX).setWaitForMerge(true).get();
     long dirSize = FileUtils.sizeOfDirectory(tester.getEsServerHolder().getHomeDir());
     LOGGER.info(String.format("ES dir: " + FileUtils.byteCountToDisplaySize(dirSize)));
     benchmark.expectBetween("ES dir size (b)", dirSize, 103L * FileUtils.ONE_MB, 109L * FileUtils.ONE_MB);
@@ -108,6 +108,7 @@ public class SourceIndexBenchmarkTest {
     private int currentProject = 0;
     private AtomicLong count = new AtomicLong(0L);
     private final FileSourceDb.Data.Builder dataBuilder = FileSourceDb.Data.newBuilder();
+    private final FileSourceDb.Line.Builder lineBuilder = FileSourceDb.Line.newBuilder();
 
     SourceIterator(long nbFiles, int nbLinesPerFile) {
       this.nbFiles = nbFiles;
@@ -128,8 +129,10 @@ public class SourceIndexBenchmarkTest {
       String projectUuid = "P" + currentProject;
       String fileUuid = "FILE" + count.get();
       dataBuilder.clear();
+
       for (int indexLine = 1; indexLine <= nbLinesPerFile; indexLine++) {
-        dataBuilder.addLinesBuilder()
+        lineBuilder.clear();
+        dataBuilder.addLines(lineBuilder
           .setLine(indexLine)
           .setScmRevision("REVISION_" + indexLine)
           .setScmAuthor("a_guy")
@@ -146,7 +149,7 @@ public class SourceIndexBenchmarkTest {
           .setScmDate(1_500_000_000_000L)
           .setHighlighting("2,9,k;9,18,k")
           .addAllDuplication(Arrays.asList(19, 33, 141))
-          .build();
+          .build());
       }
       count.incrementAndGet();
       if (count.get() % 500 == 0) {