mirror of https://github.com/apache/cassandra
Add units to stress output
Patch by Giampaolo Trapasso; reviewed by Tyler Hobbs for CASSANDRA-11352
This commit is contained in:
parent
99f0ff9384
commit
ff4d0f9abe
|
|
@ -1,4 +1,5 @@
|
|||
3.6
|
||||
* Add units to stress ouput (CASSANDRA-11352)
|
||||
* Fix PER PARTITION LIMIT for single and multi partitions queries (CASSANDRA-11603)
|
||||
* Add uncompressed chunk cache for RandomAccessReader (CASSANDRA-5863)
|
||||
* Clarify ClusteringPrefix hierarchy (CASSANDRA-11213)
|
||||
|
|
|
|||
|
|
@ -587,12 +587,17 @@ public class FBUtilities
|
|||
}
|
||||
|
||||
public static String prettyPrintMemory(long size)
|
||||
{
|
||||
return prettyPrintMemory(size, false);
|
||||
}
|
||||
|
||||
public static String prettyPrintMemory(long size, boolean includeSpace)
|
||||
{
|
||||
if (size >= 1 << 30)
|
||||
return String.format("%.3fGiB", size / (double) (1 << 30));
|
||||
return String.format("%.3f%sGiB", size / (double) (1 << 30), includeSpace ? " " : "");
|
||||
if (size >= 1 << 20)
|
||||
return String.format("%.3fMiB", size / (double) (1 << 20));
|
||||
return String.format("%.3fKiB", size / (double) (1 << 10));
|
||||
return String.format("%.3f%sMiB", size / (double) (1 << 20), includeSpace ? " " : "");
|
||||
return String.format("%.3f%sKiB", size / (double) (1 << 10), includeSpace ? " " : "");
|
||||
}
|
||||
|
||||
public static String prettyPrintMemoryPerSecond(long rate)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import org.apache.cassandra.stress.util.*;
|
|||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
import org.apache.cassandra.concurrent.NamedThreadFactory;
|
||||
import org.apache.cassandra.stress.settings.StressSettings;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
|
||||
public class StressMetrics
|
||||
{
|
||||
|
|
@ -217,22 +218,22 @@ public class StressMetrics
|
|||
|
||||
TimingIntervals opHistory = timing.getHistory();
|
||||
TimingInterval history = opHistory.combine(settings.samples.historyCount);
|
||||
output.println(String.format("op rate : %.0f %s", history.opRate(), opHistory.opRates()));
|
||||
output.println(String.format("partition rate : %.0f %s", history.partitionRate(), opHistory.partitionRates()));
|
||||
output.println(String.format("row rate : %.0f %s", history.rowRate(), opHistory.rowRates()));
|
||||
output.println(String.format("latency mean : %.1f %s", history.meanLatency(), opHistory.meanLatencies()));
|
||||
output.println(String.format("latency median : %.1f %s", history.medianLatency(), opHistory.medianLatencies()));
|
||||
output.println(String.format("latency 95th percentile : %.1f %s", history.rankLatency(.95f), opHistory.rankLatencies(0.95f)));
|
||||
output.println(String.format("latency 99th percentile : %.1f %s", history.rankLatency(0.99f), opHistory.rankLatencies(0.99f)));
|
||||
output.println(String.format("latency 99.9th percentile : %.1f %s", history.rankLatency(0.999f), opHistory.rankLatencies(0.999f)));
|
||||
output.println(String.format("latency max : %.1f %s", history.maxLatency(), opHistory.maxLatencies()));
|
||||
output.println(String.format("Total partitions : %d %s", history.partitionCount, opHistory.partitionCounts()));
|
||||
output.println(String.format("Total errors : %d %s", history.errorCount, opHistory.errorCounts()));
|
||||
output.println(String.format("total gc count : %.0f", totalGcStats.count));
|
||||
output.println(String.format("total gc mb : %.0f", totalGcStats.bytes / (1 << 20)));
|
||||
output.println(String.format("total gc time (s) : %.0f", totalGcStats.summs / 1000));
|
||||
output.println(String.format("avg gc time(ms) : %.0f", totalGcStats.summs / totalGcStats.count));
|
||||
output.println(String.format("stdev gc time(ms) : %.0f", totalGcStats.sdvms));
|
||||
output.println(String.format("Op rate : %,8.0f op/s %s", history.opRate(), opHistory.opRates()));
|
||||
output.println(String.format("Partition rate : %,8.0f pk/s %s", history.partitionRate(), opHistory.partitionRates()));
|
||||
output.println(String.format("Row rate : %,8.0f row/s %s", history.rowRate(), opHistory.rowRates()));
|
||||
output.println(String.format("Latency mean : %6.1f ms %s", history.meanLatency(), opHistory.meanLatencies()));
|
||||
output.println(String.format("Latency median : %6.1f ms %s", history.medianLatency(), opHistory.medianLatencies()));
|
||||
output.println(String.format("Latency 95th percentile : %6.1f ms %s", history.rankLatency(.95f), opHistory.rankLatencies(0.95f)));
|
||||
output.println(String.format("Latency 99th percentile : %6.1f ms %s", history.rankLatency(0.99f), opHistory.rankLatencies(0.99f)));
|
||||
output.println(String.format("Latency 99.9th percentile : %6.1f ms %s", history.rankLatency(0.999f), opHistory.rankLatencies(0.999f)));
|
||||
output.println(String.format("Latency max : %6.1f ms %s", history.maxLatency(), opHistory.maxLatencies()));
|
||||
output.println(String.format("Total partitions : %,10d %s", history.partitionCount, opHistory.partitionCounts()));
|
||||
output.println(String.format("Total errors : %,10d %s", history.errorCount, opHistory.errorCounts()));
|
||||
output.println(String.format("Total GC count : %,1.0f", totalGcStats.count));
|
||||
output.println(String.format("Total GC memory : %s", FBUtilities.prettyPrintMemory((long)totalGcStats.bytes, true)));
|
||||
output.println(String.format("Total GC time : %,6.1f seconds", totalGcStats.summs / 1000));
|
||||
output.println(String.format("Avg GC time : %,6.1f ms", totalGcStats.summs / totalGcStats.count));
|
||||
output.println(String.format("StdDev GC time : %,6.1f ms", totalGcStats.sdvms));
|
||||
output.println("Total operation time : " + DurationFormatUtils.formatDuration(
|
||||
history.runTime(), "HH:mm:ss", true));
|
||||
output.println(""); // Newline is important here to separate the aggregates section from the END or the next stress iteration
|
||||
|
|
|
|||
|
|
@ -186,16 +186,16 @@ public final class TimingInterval
|
|||
{
|
||||
switch (value)
|
||||
{
|
||||
case OPRATE: return String.format("%.0f", opRate());
|
||||
case ROWRATE: return String.format("%.0f", rowRate());
|
||||
case ADJROWRATE: return String.format("%.0f", adjustedRowRate());
|
||||
case PARTITIONRATE: return String.format("%.0f", partitionRate());
|
||||
case MEANLATENCY: return String.format("%.1f", meanLatency());
|
||||
case MAXLATENCY: return String.format("%.1f", maxLatency());
|
||||
case MEDIANLATENCY: return String.format("%.1f", medianLatency());
|
||||
case RANKLATENCY: return String.format("%.1f", rankLatency(rank));
|
||||
case ERRORCOUNT: return String.format("%d", errorCount);
|
||||
case PARTITIONCOUNT: return String.format("%d", partitionCount);
|
||||
case OPRATE: return String.format("%,.0f", opRate());
|
||||
case ROWRATE: return String.format("%,.0f", rowRate());
|
||||
case ADJROWRATE: return String.format("%,.0f", adjustedRowRate());
|
||||
case PARTITIONRATE: return String.format("%,.0f", partitionRate());
|
||||
case MEANLATENCY: return String.format("%,.1f", meanLatency());
|
||||
case MAXLATENCY: return String.format("%,.1f", maxLatency());
|
||||
case MEDIANLATENCY: return String.format("%,.1f", medianLatency());
|
||||
case RANKLATENCY: return String.format("%,.1f", rankLatency(rank));
|
||||
case ERRORCOUNT: return String.format("%,d", errorCount);
|
||||
case PARTITIONCOUNT: return String.format("%,d", partitionCount);
|
||||
default: throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,20 +48,25 @@ public class TimingIntervals
|
|||
return TimingInterval.merge(intervals.values(), maxSamples, start);
|
||||
}
|
||||
|
||||
public String str(TimingInterval.TimingParameter value)
|
||||
public String str(TimingInterval.TimingParameter value, String unit)
|
||||
{
|
||||
return str(value, Float.NaN);
|
||||
return str(value, Float.NaN, unit);
|
||||
}
|
||||
|
||||
public String str(TimingInterval.TimingParameter value, float rank)
|
||||
public String str(TimingInterval.TimingParameter value, float rank, String unit)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder("[");
|
||||
|
||||
for (Map.Entry<String, TimingInterval> entry : intervals.entrySet())
|
||||
{
|
||||
sb.append(entry.getKey());
|
||||
sb.append(":");
|
||||
sb.append(": ");
|
||||
sb.append(entry.getValue().getStringValue(value, rank));
|
||||
if (unit.length() > 0)
|
||||
{
|
||||
sb.append(" ");
|
||||
sb.append(unit);
|
||||
}
|
||||
sb.append(", ");
|
||||
}
|
||||
|
||||
|
|
@ -73,39 +78,47 @@ public class TimingIntervals
|
|||
|
||||
public String opRates()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.OPRATE);
|
||||
return str(TimingInterval.TimingParameter.OPRATE, "op/s");
|
||||
}
|
||||
|
||||
public String partitionRates()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.PARTITIONRATE);
|
||||
return str(TimingInterval.TimingParameter.PARTITIONRATE, "pk/s");
|
||||
}
|
||||
|
||||
public String rowRates()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.ROWRATE);
|
||||
return str(TimingInterval.TimingParameter.ROWRATE, "row/s");
|
||||
}
|
||||
|
||||
public String meanLatencies()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.MEANLATENCY);
|
||||
return str(TimingInterval.TimingParameter.MEANLATENCY, "ms");
|
||||
}
|
||||
|
||||
public String maxLatencies()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.MAXLATENCY);
|
||||
return str(TimingInterval.TimingParameter.MAXLATENCY, "ms");
|
||||
}
|
||||
|
||||
public String medianLatencies()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.MEDIANLATENCY);
|
||||
return str(TimingInterval.TimingParameter.MEDIANLATENCY, "ms");
|
||||
}
|
||||
|
||||
public String rankLatencies(float rank)
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.RANKLATENCY, rank);
|
||||
return str(TimingInterval.TimingParameter.RANKLATENCY, rank, "ms");
|
||||
}
|
||||
|
||||
public String errorCounts()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.ERRORCOUNT);
|
||||
return str(TimingInterval.TimingParameter.ERRORCOUNT, "");
|
||||
}
|
||||
|
||||
public String partitionCounts()
|
||||
{
|
||||
return str(TimingInterval.TimingParameter.PARTITIONCOUNT);
|
||||
return str(TimingInterval.TimingParameter.PARTITIONCOUNT, "");
|
||||
}
|
||||
|
||||
public long opRate()
|
||||
|
|
|
|||
Loading…
Reference in New Issue