Search in sources :

Example 1 with PerformanceStats

use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.

the class PerformanceStatsCollector method calculatePerformanceStats.

void calculatePerformanceStats(String testId, PerformanceStats totalPerformanceStats, Map<SimulatorAddress, PerformanceStats> agentPerformanceStatsMap) {
    for (Map.Entry<SimulatorAddress, WorkerPerformance> entry : workerPerformanceInfoMap.entrySet()) {
        SimulatorAddress workerAddress = entry.getKey();
        SimulatorAddress agentAddress = workerAddress.getParent();
        PerformanceStats agentPerformanceStats = agentPerformanceStatsMap.get(agentAddress);
        if (agentPerformanceStats == null) {
            agentPerformanceStats = new PerformanceStats();
            agentPerformanceStatsMap.put(agentAddress, agentPerformanceStats);
        }
        WorkerPerformance workerPerformance = entry.getValue();
        PerformanceStats workerTestPerformanceStats = workerPerformance.get(testId, true);
        if (workerTestPerformanceStats != null) {
            agentPerformanceStats.add(workerTestPerformanceStats);
            totalPerformanceStats.add(workerTestPerformanceStats);
        }
    }
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) Map(java.util.Map) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress)

Example 2 with PerformanceStats

use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.

the class PerformanceStatsCollector method get.

PerformanceStats get(String testCaseId, boolean aggregated) {
    // aggregate the PerformanceStats instances from all Workers by adding values (since from different Workers)
    PerformanceStats result = new PerformanceStats();
    for (WorkerPerformance workerPerformance : workerPerformanceInfoMap.values()) {
        PerformanceStats performanceStats = workerPerformance.get(testCaseId, aggregated);
        result.add(performanceStats);
    }
    return result;
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats)

Example 3 with PerformanceStats

use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.

the class PerformanceStatsCollector method detailedPerformanceInfo.

public String detailedPerformanceInfo(String testId, long runningTimeMs) {
    PerformanceStats totalPerformanceStats = new PerformanceStats();
    Map<SimulatorAddress, PerformanceStats> agentPerformanceStatsMap = new HashMap<SimulatorAddress, PerformanceStats>();
    calculatePerformanceStats(testId, totalPerformanceStats, agentPerformanceStatsMap);
    long totalOperationCount = totalPerformanceStats.getOperationCount();
    if (totalOperationCount < 1) {
        return "Performance information is not available!";
    }
    double runningTimeSeconds = (runningTimeMs * 1d) / SECONDS.toMillis(1);
    StringBuilder sb = new StringBuilder();
    double throughput = totalOperationCount / runningTimeSeconds;
    sb.append("Total running time " + secondsToHuman(Math.round(runningTimeSeconds)) + "\n");
    sb.append(format("Total throughput        %s%% %s ops %s ops/s\n", formatPercentage(1, 1), formatLong(totalOperationCount, OPERATION_COUNT_FORMAT_LENGTH), formatDouble(throughput, THROUGHPUT_FORMAT_LENGTH)));
    for (SimulatorAddress address : sort(agentPerformanceStatsMap.keySet())) {
        PerformanceStats performanceStats = agentPerformanceStatsMap.get(address);
        long operationCount = performanceStats.getOperationCount();
        sb.append(format("  Agent %-15s %s%% %s ops %s ops/s\n", address, formatPercentage(operationCount, totalOperationCount), formatLong(operationCount, OPERATION_COUNT_FORMAT_LENGTH), formatDouble(operationCount / runningTimeSeconds, THROUGHPUT_FORMAT_LENGTH)));
    }
    return sb.toString();
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) SimulatorAddress(com.hazelcast.simulator.protocol.core.SimulatorAddress)

Example 4 with PerformanceStats

use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.

the class PerformanceStatsCollector method formatIntervalPerformanceNumbers.

public String formatIntervalPerformanceNumbers(String testId) {
    PerformanceStats latest = get(testId, false);
    if (latest.isEmpty() || latest.getOperationCount() < 1) {
        return "";
    }
    String latencyUnit = "µs";
    long latencyAvg = NANOSECONDS.toMicros(round(latest.getIntervalLatencyAvgNanos()));
    long latency999Percentile = NANOSECONDS.toMicros(latest.getIntervalLatency999PercentileNanos());
    long latencyMax = NANOSECONDS.toMicros(latest.getIntervalLatencyMaxNanos());
    if (latencyAvg > DISPLAY_LATENCY_AS_MICROS_MAX_VALUE) {
        latencyUnit = "ms";
        latencyAvg = MICROSECONDS.toMillis(latencyAvg);
        latency999Percentile = MICROSECONDS.toMillis(latency999Percentile);
        latencyMax = MICROSECONDS.toMillis(latencyMax);
    }
    return format("%s ops %s ops/s %s %s (avg) %s %s (%sth) %s %s (max)", formatLong(latest.getOperationCount(), OPERATION_COUNT_FORMAT_LENGTH), formatDouble(latest.getIntervalThroughput(), THROUGHPUT_FORMAT_LENGTH), formatLong(latencyAvg, LATENCY_FORMAT_LENGTH), latencyUnit, formatLong(latency999Percentile, LATENCY_FORMAT_LENGTH), latencyUnit, INTERVAL_LATENCY_PERCENTILE, formatLong(latencyMax, LATENCY_FORMAT_LENGTH), latencyUnit);
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats)

Example 5 with PerformanceStats

use of com.hazelcast.simulator.worker.performance.PerformanceStats in project hazelcast-simulator by hazelcast.

the class TestCaseRunner method logFinalPerformanceInfo.

private void logFinalPerformanceInfo(long startMs) {
    // the running time of the test is current time minus the start time. We can't rely on testsuite duration
    // due to premature abortion of a test. Or if the test has no explicit duration configured
    long durationWithWarmupMillis = currentTimeMillis() - startMs;
    // then we need to subtract the warmup.
    long durationMillis = durationWithWarmupMillis;
    if (performanceMonitorIntervalSeconds > 0) {
        LOGGER.info(testCase.getId() + " Waiting for all performance info");
        sleepSeconds(performanceMonitorIntervalSeconds);
        String performanceInfo = performanceStatsCollector.detailedPerformanceInfo(testCase.getId(), durationMillis);
        LOGGER.info("Performance " + testCase.getId() + "\n" + performanceInfo);
        PerformanceStats performanceStats = performanceStatsCollector.get(testCase.getId(), true);
        File performanceFile = new File(coordinatorParameters.getOutputDirectory(), "performance.txt");
        long operationCount = performanceStats.getOperationCount();
        appendText("operations=" + operationCount + "\n", performanceFile);
        appendText("durationMillis=" + durationMillis + "\n", performanceFile);
        appendText("tps=" + ((THOUSAND * operationCount) / durationMillis) + "\n", performanceFile);
    }
}
Also used : PerformanceStats(com.hazelcast.simulator.worker.performance.PerformanceStats) AgentData.publicAddressesString(com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString) File(java.io.File) FileUtils.getConfigurationFile(com.hazelcast.simulator.utils.FileUtils.getConfigurationFile)

Aggregations

PerformanceStats (com.hazelcast.simulator.worker.performance.PerformanceStats)14 Test (org.junit.Test)9 SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)6 HashMap (java.util.HashMap)6 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 AgentData.publicAddressesString (com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString)1 FileUtils.getConfigurationFile (com.hazelcast.simulator.utils.FileUtils.getConfigurationFile)1 PerformanceStatsOperation (com.hazelcast.simulator.worker.operations.PerformanceStatsOperation)1 File (java.io.File)1 Map (java.util.Map)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1