Skip to content

Commit

Permalink
Incorporate CR feedback:
Browse files Browse the repository at this point in the history
1. Use LinkedList rather than ArrayList for the measurement array in RAW. Update size estimation in documentation in workload_template.

2. Add a new composite measurement type which combines HdrHistogram and RAW.

3. Allow user to optionally disable output of summary stats from the raw measurement class.
  • Loading branch information
stfeng2 committed Nov 3, 2015
1 parent 8947b1c commit 8bfadae
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
Expand Up @@ -38,6 +38,7 @@ public enum MeasurementType {
HISTOGRAM,
HDRHISTOGRAM,
HDRHISTOGRAM_AND_HISTOGRAM,
HDRHISTOGRAM_AND_RAW,
TIMESERIES,
RAW
}
Expand Down Expand Up @@ -97,6 +98,10 @@ else if (mTypeString.equals("hdrhistogram+histogram"))
{
_measurementType = MeasurementType.HDRHISTOGRAM_AND_HISTOGRAM;
}
else if (mTypeString.equals("hdrhistogram+raw"))
{
_measurementType = MeasurementType.HDRHISTOGRAM_AND_RAW;
}
else if (mTypeString.equals("timeseries"))
{
_measurementType = MeasurementType.TIMESERIES;
Expand Down Expand Up @@ -139,6 +144,10 @@ OneMeasurement constructOneMeasurement(String name)
return new TwoInOneMeasurement(name,
new OneMeasurementHdrHistogram("Hdr"+name, _props),
new OneMeasurementHistogram("Bucket"+name, _props));
case HDRHISTOGRAM_AND_RAW:
return new TwoInOneMeasurement(name,
new OneMeasurementHdrHistogram("Hdr"+name, _props),
new OneMeasurementHistogram("Raw"+name, _props));
case TIMESERIES:
return new OneMeasurementTimeSeries(name, _props);
case RAW:
Expand Down
Expand Up @@ -22,7 +22,7 @@
import java.io.IOException;
import java.io.PrintStream;
import java.util.Properties;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Collections;
import java.util.Comparator;
import com.yahoo.ycsb.measurements.exporter.MeasurementsExporter;
Expand Down Expand Up @@ -77,14 +77,28 @@ public int compare(RawDataPoint p1, RawDataPoint p2){
*/
public static final String OUTPUT_FILE_PATH = "measurement.raw.output_file";
public static final String OUTPUT_FILE_PATH_DEFAULT = "";

/**
* Optionally, user can request to not output summary stats. This is useful
* if the user chains the raw measurement type behind the HdrHistogram type
* which already outputs summary stats. But even in that case, the user may
* still want this class to compute summary stats for them, especially if
* they want accurate computation of percentiles (because percentils computed
* by histogram classes are still approximations).
*/
public static final String NO_SUMMARY_STATS = "measurement.raw.no_summary";
public static final String NO_SUMMARY_STATS_DEFAULT = "false";

private String outputFilePath = "";
private final PrintStream outputStream;

private ArrayList<RawDataPoint> measurements;
private boolean noSummaryStats = false;

private LinkedList<RawDataPoint> measurements;
private long totalLatency = 0;

// A window of stats to print summary for at the next getSummary() call.
// It's supposed to be a one line summary, so we will just print count and
// It's supposed to be a one line summary, so we will just print count and
// average.
private int windowOperations = 0;
private long windowTotalLatency = 0;
Expand All @@ -111,7 +125,11 @@ public OneMeasurementRaw(String name, Properties props) {
outputStream = System.out;

}
measurements = new ArrayList<RawDataPoint>(1000);

noSummaryStats = Boolean.parseBoolean(props.getProperty(NO_SUMMARY_STATS,
NO_SUMMARY_STATS_DEFAULT));

measurements = new LinkedList<RawDataPoint>();
}

@Override
Expand Down Expand Up @@ -142,7 +160,7 @@ public void exportMeasurements(MeasurementsExporter exporter)

int totalOps = measurements.size();
exporter.write(getName(), "Total Operations", totalOps);
if (totalOps > 0) {
if (totalOps > 0 && !noSummaryStats) {
exporter.write(getName(),
"Below is a summary of latency in microseconds:", -1);
exporter.write(getName(), "Average",
Expand Down
8 changes: 4 additions & 4 deletions workloads/workload_template
Expand Up @@ -121,11 +121,11 @@ measurementtype=histogram
# "operation, timestamp of the measurement, latency in us"
#
# Raw datapoints are collected in-memory while the test is running. Each
# data point consumes about 20 bytes (including java object overhead).
# data point consumes about 50 bytes (including java object overhead).
# For a typical run of 1 million to 10 million operations, this should
# easily fit into memory. If you plan to do a run with 100s of millions of
# operations, consider increasing your jvm heap size before you enable the
# RAW measurement type, or split the run into multiple runs.
# fit into memory most of the time. If you plan to do 100s of millions of
# operations per run, consider provisioning a machine with larger RAM when using
# the RAW measurement type, or split the run into multiple runs.
#
# Optionally, you can specify an output file to save raw datapoints.
# Otherwise, raw datapoints will be written to stdout.
Expand Down

0 comments on commit 8bfadae

Please sign in to comment.