diff --git oak-segment-tar/pom.xml oak-segment-tar/pom.xml index f701e18..7bf9cdb 100644 --- oak-segment-tar/pom.xml +++ oak-segment-tar/pom.xml @@ -45,7 +45,6 @@ - commons-math3, netty-* @@ -182,11 +181,6 @@ provided - org.apache.commons - commons-math3 - compile - - com.google.guava guava provided diff --git oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java index 8507221..da9af92 100644 --- oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java +++ oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java @@ -32,10 +32,8 @@ import static com.google.common.collect.Lists.newArrayListWithExpectedSize; import static com.google.common.collect.Lists.partition; import static com.google.common.collect.Maps.newHashMap; import static com.google.common.io.ByteStreams.read; -import static java.lang.Integer.getInteger; import static java.lang.Long.numberOfLeadingZeros; import static java.lang.Math.min; -import static java.lang.System.nanoTime; import static java.util.Arrays.asList; import static java.util.Collections.emptyMap; import static java.util.Collections.nCopies; @@ -64,8 +62,6 @@ import javax.jcr.PropertyType; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.io.Closeables; -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; -import org.apache.commons.math3.stat.descriptive.SynchronizedDescriptiveStatistics; import org.apache.jackrabbit.oak.api.Blob; import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.api.Type; @@ -88,14 +84,6 @@ import org.slf4j.LoggerFactory; public class SegmentWriter { private static final Logger LOG = LoggerFactory.getLogger(SegmentWriter.class); - /** - * Size of the window for collecting statistics about the time it takes to - * write / compact nodes. - * @see DescriptiveStatistics#setWindowSize(int) - */ - private static final int NODE_WRITER_STATS_WINDOW = getInteger( - "oak.tar.nodeWriterStatsWindow", 10000); - static final int BLOCK_SIZE = 1 << 12; // 4kB @Nonnull @@ -113,14 +101,6 @@ public class SegmentWriter { @Nonnull private final WriteOperationHandler writeOperationHandler; - @Nonnull - private final SynchronizedDescriptiveStatistics nodeCompactTimeStats = - new SynchronizedDescriptiveStatistics(NODE_WRITER_STATS_WINDOW); - - @Nonnull - private final SynchronizedDescriptiveStatistics nodeWriteTimeStats = - new SynchronizedDescriptiveStatistics(NODE_WRITER_STATS_WINDOW); - /** * Create a new instance of a {@code SegmentWriter}. Note the thread safety properties * pointed out in the class comment. @@ -146,18 +126,6 @@ public class SegmentWriter { } /** - * @return Statistics for node compaction times (in ns). These statistics - * include explicit compactions triggered by the file store and implicit - * compactions triggered by references to older generations. - * The statistics are collected with a window size defined by {@link #NODE_WRITER_STATS_WINDOW} - * @see #getNodeWriteTimeStats() - */ - @Nonnull - public DescriptiveStatistics getNodeCompactTimeStats() { - return nodeCompactTimeStats; - } - - /** * Get occupancy information for the node deduplication cache indicating occupancy and * evictions per priority. * @return occupancy information for the node deduplication cache. @@ -167,16 +135,6 @@ public class SegmentWriter { return cacheManager.getNodeCacheOccupancyInfo(); } - /** - * @return Statistics for node write times (in ns). - * The statistics are collected with a window size defined by {@link #NODE_WRITER_STATS_WINDOW} - * @see #getNodeCompactTimeStats() - */ - @Nonnull - public DescriptiveStatistics getNodeWriteTimeStats() { - return nodeWriteTimeStats; - } - public void flush() throws IOException { writeOperationHandler.flush(); } @@ -393,8 +351,6 @@ public class SegmentWriter { */ private abstract class SegmentWriteOperation implements WriteOperation { private class NodeWriteStats { - private final long startTime = nanoTime(); - /* * Total number of nodes in the subtree rooted at the node passed * to {@link #writeNode(SegmentWriteOperation, SegmentBufferWriter, NodeState)} @@ -801,7 +757,6 @@ public class SegmentWriter { RecordId recordId; - String binaryReference; if (data.length < Segment.BLOB_ID_SMALL_LIMIT) { recordId = RecordWriters.newBlobIdWriter(data).write(writer); } else { @@ -1000,13 +955,7 @@ public class SegmentWriter { try { return writeNode(state, 0); } finally { - if (nodeWriteStats.isCompactOp) { - nodeCompactTimeStats.addValue(nanoTime() - nodeWriteStats.startTime); - LOG.info("{}", nodeWriteStats); - } else { - nodeWriteTimeStats.addValue(nanoTime() - nodeWriteStats.startTime); - LOG.debug("{}", nodeWriteStats); - } + LOG.debug("{}", nodeWriteStats); } } diff --git oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java index 7145bd1..d697d56 100644 --- oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java +++ oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java @@ -69,7 +69,6 @@ import com.google.common.base.Stopwatch; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean; import org.apache.jackrabbit.oak.plugins.blob.ReferenceCollector; import org.apache.jackrabbit.oak.segment.Compactor; @@ -760,7 +759,6 @@ public class FileStore extends AbstractFileStore { if (sufficientEstimatedGain) { if (!gcOptions.isPaused()) { - logAndClear(segmentWriter.getNodeWriteTimeStats(), segmentWriter.getNodeCompactTimeStats()); log(segmentWriter.getNodeCacheOccupancyInfo()); int gen = compact(); if (gen > 0) { @@ -769,7 +767,6 @@ public class FileStore extends AbstractFileStore { gcListener.info("TarMK GC #{}: cleaning up after failed compaction", GC_COUNT); fileReaper.add(cleanupGeneration(-gen)); } - logAndClear(segmentWriter.getNodeWriteTimeStats(), segmentWriter.getNodeCompactTimeStats()); log(segmentWriter.getNodeCacheOccupancyInfo()); } else { gcListener.skipped("TarMK GC #{}: compaction paused", GC_COUNT); @@ -792,37 +789,12 @@ public class FileStore extends AbstractFileStore { stats.getApproximateSize()); } - private void logAndClear( - @Nonnull DescriptiveStatistics nodeWriteTimeStats, - @Nonnull DescriptiveStatistics nodeCompactTimeStats) { - log.info("Node write time statistics (ns) {}", toString(nodeWriteTimeStats)); - log.info("Node compact time statistics (ns) {}", toString(nodeCompactTimeStats)); - nodeWriteTimeStats.clear(); - nodeCompactTimeStats.clear(); - } - private void log(@CheckForNull String nodeCacheOccupancyInfo) { if (nodeCacheOccupancyInfo != null) { log.info("NodeCache occupancy: {}", nodeCacheOccupancyInfo); } } - private String toString(DescriptiveStatistics statistics) { - DecimalFormat sci = new DecimalFormat("##0.0E0"); - DecimalFormatSymbols symbols = sci.getDecimalFormatSymbols(); - symbols.setNaN("NaN"); - symbols.setInfinity("Inf"); - sci.setDecimalFormatSymbols(symbols); - return "min=" + sci.format(statistics.getMin()) + - ", 10%=" + sci.format(statistics.getPercentile(10.0)) + - ", 50%=" + sci.format(statistics.getPercentile(50.0)) + - ", 90%=" + sci.format(statistics.getPercentile(90.0)) + - ", max=" + sci.format(statistics.getMax()) + - ", mean=" + sci.format(statistics.getMean()) + - ", stdev=" + sci.format(statistics.getStandardDeviation()) + - ", N=" + sci.format(statistics.getN()); - } - synchronized int compact() throws IOException { final int newGeneration = getGcGeneration() + 1; try {