use of com.twitter.heron.healthmgr.common.ComponentMetricsHelper in project incubator-heron by apache.
the class DataSkewDiagnoser method diagnose.
@Override
public Diagnosis diagnose(List<Symptom> symptoms) {
List<Symptom> bpSymptoms = getBackPressureSymptoms(symptoms);
Map<String, ComponentMetrics> processingRateSkewComponents = getProcessingRateSkewComponents(symptoms);
Map<String, ComponentMetrics> waitQDisparityComponents = getWaitQDisparityComponents(symptoms);
if (bpSymptoms.isEmpty() || processingRateSkewComponents.isEmpty() || waitQDisparityComponents.isEmpty()) {
// Since there is no back pressure or disparate execute count, no action is needed
return null;
} else if (bpSymptoms.size() > 1) {
// TODO handle cases where multiple detectors create back pressure symptom
throw new IllegalStateException("Multiple back-pressure symptoms case");
}
ComponentMetrics bpMetrics = bpSymptoms.iterator().next().getComponent();
// verify data skew, larger queue size and back pressure for the same component exists
ComponentMetrics exeCountMetrics = processingRateSkewComponents.get(bpMetrics.getName());
ComponentMetrics pendingBufferMetrics = waitQDisparityComponents.get(bpMetrics.getName());
if (exeCountMetrics == null || pendingBufferMetrics == null) {
// for the component with back pressure. This is not a data skew case
return null;
}
ComponentMetrics mergedData = ComponentMetrics.merge(bpMetrics, ComponentMetrics.merge(exeCountMetrics, pendingBufferMetrics));
ComponentMetricsHelper compStats = new ComponentMetricsHelper(mergedData);
compStats.computeBpStats();
MetricsStats exeStats = compStats.computeMinMaxStats(METRIC_EXE_COUNT);
MetricsStats bufferStats = compStats.computeMinMaxStats(METRIC_BUFFER_SIZE);
Symptom resultSymptom = null;
for (InstanceMetrics boltMetrics : compStats.getBoltsWithBackpressure()) {
double exeCount = boltMetrics.getMetricValueSum(METRIC_EXE_COUNT.text());
double bufferSize = boltMetrics.getMetricValueSum(METRIC_BUFFER_SIZE.text());
double bpValue = boltMetrics.getMetricValueSum(METRIC_BACK_PRESSURE.text());
if (exeStats.getMetricMax() < 1.10 * exeCount && bufferStats.getMetricMax() < 2 * bufferSize) {
LOG.info(String.format("DataSkew: %s back-pressure(%s), high execution count: %s and " + "high buffer size %s", boltMetrics.getName(), bpValue, exeCount, bufferSize));
resultSymptom = new Symptom(SYMPTOM_DATA_SKEW.text(), mergedData);
}
}
return resultSymptom != null ? new Diagnosis(DIAGNOSIS_DATA_SKEW.text(), resultSymptom) : null;
}
use of com.twitter.heron.healthmgr.common.ComponentMetricsHelper in project incubator-heron by apache.
the class UnderProvisioningDiagnoser method diagnose.
@Override
public Diagnosis diagnose(List<Symptom> symptoms) {
List<Symptom> bpSymptoms = getBackPressureSymptoms(symptoms);
Map<String, ComponentMetrics> processingRateSkewComponents = getProcessingRateSkewComponents(symptoms);
Map<String, ComponentMetrics> waitQDisparityComponents = getWaitQDisparityComponents(symptoms);
if (bpSymptoms.isEmpty() || !processingRateSkewComponents.isEmpty() || !waitQDisparityComponents.isEmpty()) {
// and buffer sizes, no action is needed
return null;
} else if (bpSymptoms.size() > 1) {
// TODO handle cases where multiple detectors create back pressure symptom
throw new IllegalStateException("Multiple back-pressure symptoms case");
}
ComponentMetrics bpMetrics = bpSymptoms.iterator().next().getComponent();
ComponentMetricsHelper compStats = new ComponentMetricsHelper(bpMetrics);
compStats.computeBpStats();
LOG.info(String.format("UNDER_PROVISIONING: %s back-pressure(%s) and similar processing rates " + "and buffer sizes", bpMetrics.getName(), compStats.getTotalBackpressure()));
Symptom resultSymptom = new Symptom(SYMPTOM_UNDER_PROVISIONING.text(), bpMetrics);
return new Diagnosis(DIAGNOSIS_UNDER_PROVISIONING.text(), resultSymptom);
}
Aggregations