Ejemplo n.º 1
0
    def data_event(self, executor):
        self.logger.debug("Event received")

        if executor.terminated:
            self._push_to_db(executor)
        else:
            workload = '.'.join(executor.current_workload.split('.')[1:6])
            if 'metrics' not in executor.metadata:
                executor.metadata['metrics'] = {}

            steady_state = True
            metrics = {}
            for metric in ('lat_ns.mean', 'iops', 'bw'):
                metrics[metric] = {}
                for io_type in ('read', 'write'):
                    metrics[metric][io_type] = {}

                    series = self._lookup_prior_data(executor, metric, io_type)
                    series = self._convert_timestamps_to_samples(
                        executor, series)
                    steady = self._evaluate_prior_data(
                        series, executor.steady_state_samples)

                    self.logger.debug("Steady state for %s %s: %s" %
                                      (io_type, metric, steady))

                    metrics[metric][io_type]['series'] = series
                    metrics[metric][io_type]['steady_state'] = steady
                    treated_data = DataTreatment.data_treatment(series)

                    metrics[metric][io_type]['slope'] = \
                        math.slope(treated_data['slope_data'])
                    metrics[metric][io_type]['range'] = \
                        math.range_value(treated_data['range_data'])
                    average = math.average(treated_data['average_data'])
                    metrics[metric][io_type]['average'] = average

                    metrics_key = '%s.%s.%s' % (workload, io_type, metric)
                    executor.metadata['metrics'][metrics_key] = average

                    if not steady:
                        steady_state = False

            if 'report_data' not in executor.metadata:
                executor.metadata['report_data'] = {}

            if 'steady_state' not in executor.metadata:
                executor.metadata['steady_state'] = {}

            executor.metadata['report_data'][workload] = metrics
            executor.metadata['steady_state'][workload] = steady_state

            workload_name = executor.current_workload.split('.')[1]

            if steady_state and not workload_name.startswith('_'):
                executor.terminate_current_run()
Ejemplo n.º 2
0
def steady_state(data_series):
    """
    This function seeks to detect steady state given on a measurement
    window given the data series of that measurement window following
    the pattern : [[x1,y1], [x2,y2], ..., [xm,ym]]. m represents the number
    of points recorded in the measurement window, x which represents the
    time, and y which represents the Volume performance variable being
    tested e.g. IOPS, latency...
    The function returns a boolean describing wether or not steady state
    has been reached with the data that is passed to it.
    """

    logger = logging.getLogger('storperf.utilities.steady_state')

    # Pre conditioning the data to match the algorithms
    treated_data = DataTreatment.data_treatment(data_series)

    # Calculating useful values invoking dedicated functions
    slope_value = math.slope(treated_data['slope_data'])
    range_value = math.range_value(treated_data['range_data'])
    average_value = math.average(treated_data['average_data'])

    if (slope_value is not None and range_value is not None
            and average_value is not None):
        # Verification of the Steady State conditions following the SNIA
        # definition
        range_condition = abs(range_value) <= 0.20 * abs(average_value)
        slope_condition = abs(slope_value) <= 0.10 * abs(average_value)

        steady_state = range_condition and slope_condition

        logger.debug("Range %s <= %s?" % (abs(range_value),
                                          (0.20 * abs(average_value))))
        logger.debug("Slope %s <= %s?" % (abs(slope_value),
                                          (0.10 * abs(average_value))))
        logger.debug("Steady State? %s" % steady_state)
    else:
        steady_state = False

    return steady_state
Ejemplo n.º 3
0
 def test_slope_0_in_x_and_y(self):
     expected = 1.5
     actual = Slope.slope([[0.0, 0], [1, 1], [2, 3]])
     self.assertEqual(expected, actual)
Ejemplo n.º 4
0
 def test_infinte_slope(self):
     expected = None
     actual = Slope.slope([[1480623510, 1295.87], [1480623520, 1380.79]])
     self.assertEqual(expected, actual)
Ejemplo n.º 5
0
 def test_slope_0_in_y(self):
     expected = -0.5
     actual = Slope.slope([[15.5, 1], [16.5, 0], [17.5, 0]])
     self.assertEqual(expected, actual)
Ejemplo n.º 6
0
 def test_slope_0_in_x(self):
     expected = 1.4
     actual = Slope.slope([[0, 6.0], [1, 5], [2, 7], [3, 10]])
     self.assertEqual(expected, actual)
Ejemplo n.º 7
0
 def test_slope_negative_x_series(self):
     expected = 1.4
     actual = Slope.slope([[-24, 6.0], [-23, 5], [-22, 7.0], [-21, 10]])
     self.assertEqual(expected, actual)
Ejemplo n.º 8
0
 def test_slope_out_of_order_series(self):
     expected = 1.4
     actual = Slope.slope([[2, 5.0], [4, 10], [3.0, 7], [1, 6]])
     self.assertEqual(expected, actual)
Ejemplo n.º 9
0
 def test_slope_negative_y_series(self):
     expected = 2
     actual = Slope.slope([[1.0, -2], [2, 2], [3, 2]])
     self.assertEqual(expected, actual)
Ejemplo n.º 10
0
 def test_slope_decimal_integer_mix(self):
     expected = 1.4
     actual = Slope.slope([[1.0, 6], [2, 5.0], [3, 7], [4.0, 10]])
     self.assertEqual(expected, actual)
Ejemplo n.º 11
0
 def test_slope_decimal_series(self):
     expected = 1.4
     actual = Slope.slope([[1.0, 6.0], [2.0, 5.0], [3.0, 7.0], [4.0, 10.0]])
     self.assertEqual(expected, actual)
Ejemplo n.º 12
0
 def test_slope_integer_series(self):
     expected = 1.4
     actual = Slope.slope([[1, 6], [2, 5], [3, 7], [4, 10]])
     self.assertEqual(expected, actual)
Ejemplo n.º 13
0
 def test_slope_empty_series(self):
     expected = None
     actual = Slope.slope([])
     self.assertEqual(expected, actual)