Search in sources :

Example 1 with StatSeries

use of com.ms.silverking.numeric.StatSeries in project SilverKing by Morgan-Stanley.

the class BulkThroughput method runTest.

public void runTest(BulkThroughputTest test, TestParameters p, int externalReps, int threadID, SynchronousNamespacePerspective<String, byte[]> syncNSP, AsynchronousNamespacePerspective<String, byte[]> asyncNSP) throws PutException, RetrievalException {
    List<Double> throughputList;
    List<Double> allBatchTimes;
    String context;
    context = keyPrefix + threadID + ".";
    int size = externalReps * ((p.maxKey - p.minKey) / p.batchSize + 1);
    allBatchTimes = new ArrayList<>(size);
    System.out.println("max: " + p.maxKey);
    System.out.println("min: " + p.minKey);
    System.out.println("batchSize: " + p.batchSize);
    System.out.println("size: " + size);
    throughputList = new ArrayList<>(externalReps);
    for (int j = 0; j < externalReps; j++) {
        Stopwatch sw;
        double _Mbps;
        int valueSize;
        List<Double> batchTimes;
        double iops;
        switch(test) {
            case Write:
                valueSize = values[0].length;
                break;
            default:
                valueSize = -1;
        }
        batchTimes = new ArrayList<>((p.maxKey - p.minKey) / p.batchSize + 1);
        sw = new SimpleStopwatch();
        for (int i = 0; i < p.repetitions; i++) {
            switch(test) {
                case Write:
                    write(p, batchTimes, context, syncNSP);
                    break;
                case Read:
                    valueSize = read(p, batchTimes, context, syncNSP);
                    break;
                case ReadAsync:
                    valueSize = readAsync(p, context, asyncNSP);
                    break;
                default:
                    throw new RuntimeException("Panic");
            }
        }
        sw.stop();
        allBatchTimes.addAll(batchTimes);
        long bytes;
        out.printf("valueSize %d\n\n", valueSize);
        StatSeries batchStats;
        batchStats = new StatSeries(batchTimes);
        bytes = calcBytes(p, valueSize);
        _Mbps = NetUtil.calcMbps(bytes, sw);
        iops = (double) (p.numKeys * p.repetitions) / sw.getElapsedSeconds();
        out.printf("Elapsed           %s\n", sw);
        out.printf("Bytes             %d\n", bytes);
        out.printf("Throughput (Mbps) %f\n", _Mbps);
        out.printf("Throughput (IOPS) %f\n", iops);
        out.printf("Sum               %f\n", batchStats.sum());
        out.printf("Max               %f\n", batchStats.max());
        out.printf("50%%               %f\n", batchStats.percentile(90));
        out.printf("90%%               %f\n", batchStats.percentile(90));
        out.printf("95%%               %f\n", batchStats.percentile(95));
        out.printf("99%%               %f\n", batchStats.percentile(99));
        throughputList.add(_Mbps);
    }
    StatSeries allBatchStats;
    allBatchStats = new StatSeries(allBatchTimes);
    out.printf("\n\nSum               %f\n\n", allBatchStats.sum());
    out.printf("Max               %f\n\n", allBatchStats.max());
    for (int i = 0; i <= 95; i += 5) {
        out.printf("%3d%%\t%f\n", i, allBatchStats.percentile(i));
    }
    out.printf("%3d%%\t%f\n", 99, allBatchStats.percentile(99));
    out.println(StatSeries.summaryHeaderString());
    out.println(new StatSeries(throughputList).toSummaryString());
}
Also used : StatSeries(com.ms.silverking.numeric.StatSeries) Stopwatch(com.ms.silverking.time.Stopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch)

Example 2 with StatSeries

use of com.ms.silverking.numeric.StatSeries in project SilverKing by Morgan-Stanley.

the class BulkThroughputAnalysis method processReplicaTimeStats.

private void processReplicaTimeStats() throws RetrievalException {
    for (String key : keyTimes.keySet()) {
        // out.println(key +"\t"+ keyTimes.get(key));
        storeReplicaTimes(key, keyTimes.get(key));
    }
    for (String replica : replicaTimes.getKeys()) {
        List<Double> times;
        StatSeries replicaStats;
        times = replicaTimes.getList(replica);
        replicaStats = new StatSeries(times);
        out.printf("%s\t%f\t%f\t%f\n", replica, replicaStats.mean(), replicaStats.median(), replicaStats.max());
        for (int i = 0; i <= 95; i += 5) {
            out.printf("%3d%%\t%f\n", i, replicaStats.percentile(i));
        }
        out.printf("%3d%%\t%f\n", 99, replicaStats.percentile(99));
    }
}
Also used : StatSeries(com.ms.silverking.numeric.StatSeries)

Example 3 with StatSeries

use of com.ms.silverking.numeric.StatSeries in project SilverKing by Morgan-Stanley.

the class BulkThroughputAnalysis method runParallelTests_B.

public void runParallelTests_B(BulkThroughputTest test, TestParameters p, int externalReps) throws PutException, RetrievalException {
    List<Double> throughputList;
    List<Double> allBatchTimes;
    allBatchTimes = new ArrayList<>(externalReps * ((p.maxKey - p.minKey) / p.batchSize + 1));
    throughputList = new ArrayList<>(externalReps);
    for (int j = 0; j < externalReps; j++) {
        Stopwatch sw;
        double _Mbps;
        int valueSize;
        List<Double> batchTimes;
        sw = new SimpleStopwatch();
        // temporary
        batchTimes = null;
        switch(test) {
            case Write:
                valueSize = values[0].length;
                break;
            default:
                valueSize = -1;
        }
        allBatchTimes.addAll(batchTimes);
        long bytes;
        out.printf("valueSize %d\n\n", valueSize);
        StatSeries batchStats;
        batchStats = new StatSeries(batchTimes);
        bytes = calcBytes(p, valueSize);
        _Mbps = NetUtil.calcMbps(bytes, sw);
        out.printf("Elapsed           %s\n", sw);
        out.printf("Bytes             %d\n", bytes);
        out.printf("Throughput (Mbps) %f\n", _Mbps);
        out.printf("Sum               %f\n", batchStats.sum());
        out.printf("Max               %f\n", batchStats.max());
        out.printf("50%%               %f\n", batchStats.percentile(50));
        out.printf("95%%               %f\n", batchStats.percentile(90));
        out.printf("90%%               %f\n", batchStats.percentile(95));
        out.printf("99%%               %f\n", batchStats.percentile(99));
        throughputList.add(_Mbps);
    }
    StatSeries allBatchStats;
    allBatchStats = new StatSeries(allBatchTimes);
    out.printf("\n\nSum               %f\n\n", allBatchStats.sum());
    out.printf("Max               %f\n\n", allBatchStats.max());
    for (int i = 0; i <= 95; i += 5) {
        out.printf("%3d%%\t%f\n", i, allBatchStats.percentile(i));
    }
    out.printf("%3d%%\t%f\n", 99, allBatchStats.percentile(99));
    out.println(StatSeries.summaryHeaderStringLow());
    out.println(new StatSeries(throughputList).toSummaryStringLow());
    out.println("\n\n");
// processReplicaTimeStats();
}
Also used : StatSeries(com.ms.silverking.numeric.StatSeries) Stopwatch(com.ms.silverking.time.Stopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch)

Example 4 with StatSeries

use of com.ms.silverking.numeric.StatSeries in project SilverKing by Morgan-Stanley.

the class Trace method intervalMillis.

public int intervalMillis() {
    List<Double> dSamples;
    long median;
    long maxDeviation;
    long intervalTotal;
    long intervalSamples;
    dSamples = new ArrayList<>(samples.size() - 1);
    for (int i = 0; i < samples.size() - 1; i++) {
        long interval;
        interval = samples.get(i + 1).getAbsTimeMillis() - samples.get(i).getAbsTimeMillis();
        dSamples.add(new Double(interval));
    }
    median = (long) new StatSeries(dSamples).median();
    maxDeviation = (long) ((double) median * intervalOutlierThreshold);
    intervalTotal = 0;
    intervalSamples = 0;
    for (int i = 0; i < samples.size() - 1; i++) {
        long interval;
        interval = samples.get(i + 1).getAbsTimeMillis() - samples.get(i).getAbsTimeMillis();
        if (Math.abs(interval - median) <= maxDeviation) {
            intervalSamples++;
            intervalTotal += interval;
        }
    }
    return (int) (intervalTotal / intervalSamples);
}
Also used : StatSeries(com.ms.silverking.numeric.StatSeries)

Aggregations

StatSeries (com.ms.silverking.numeric.StatSeries)4 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)2 Stopwatch (com.ms.silverking.time.Stopwatch)2