Version: 7.0.0

Forecast ​

Overview ​

The trend prediction module predicts the future time series change trend based on historical time series data. The framework of this module has been decoupled to flexibly change prediction algorithms. This module can automatically select algorithms for different feature time series. The LR regression algorithm for linear feature time series prediction and the ARIMA algorithm for non-linear feature prediction are supported. At present, this module can cover the accurate prediction of linear time series, non-linear time series and periodic time series.

Environment Deployment ​

The metric collection system is running properly.

Usage Guide ​

Assume that the confpath configuration file directory has been initialized.

  • Run the following command to start only the slow SQL diagnosis function (the number of root causes for slow SQL diagnosis is determined by the algorithm running result and is not fixed). For more usage, see the description of the service subcommand.

    gs_dbmind service start -c confpath --only-run slow_query_diagnosis
  • Run the following command to query the diagnosis history of slow SQL statements:

    gs_dbmind component slow_query_diagnosis show -c confpath --query SQL --start-time timestamps0 --end-time timestamps1
  • Run the following command to diagnose slow SQL statements in interactive mode:

    gs_dbmind component slow_query_diagnosis diagnosis -c confpath --database dbname --schema schema_name --query SQL
  • Run the following command to manually clear historical prediction results:

    gs_dbmind component slow_query_diagnosis clean -c confpath --retention-days DAYS
  • Run the following command to stop the services that have been started:

    gs_dbmind service stop -c confpath

Obtaining Help Information ​

You can run the --help command to obtain the help information. For example:

gs_dbmind component forecast --help
usage: forecast.py [-h] -c DIRECTORY [--metric-name METRIC_NAME] [--host HOST]
                   [--labels LABELS] [--start-time TIMESTAMP_IN_MICROSECONDS]
                   [--end-time TIMESTAMP_IN_MICROSECONDS]
                   [--retention-days DAYS] [--upper UPPER] [--lower LOWER]
                   [--warning-hours WARNING-HOURS]
                   [--csv-dump-path CSV_DUMP_PATH]
                   {show,clean,early-warning}

Workload Forecasting: Forecast monitoring metrics

positional arguments:
  {show,clean,early-warning}
                        Choose a functionality to perform

optional arguments:
  -h, --help            show this help message and exit
  -c DIRECTORY, --conf DIRECTORY
                        Set the directory of configuration files
  --metric-name METRIC_NAME
                        Set a metric name you want to retrieve
  --host HOST           Set a host you want to retrieve. IP only or IP with
                        port.
  --labels LABELS       A list of label (format is label=name) separated by
                        comma(,). Using in warning.
  --start-time TIMESTAMP_IN_MICROSECONDS
                        Set a start time for retrieving, supporting UNIX-
                        timestamp with microsecond or datetime format
  --end-time TIMESTAMP_IN_MICROSECONDS
                        Set an end time for retrieving, supporting UNIX-
                        timestamp with microsecond or datetime format
  --retention-days DAYS
                        Clear historical diagnosis results and set the maximum
                        number of days to retain data
  --upper UPPER         The upper value of early-warning. Using in warning.
  --lower LOWER         The lower value of early-warning. Using in warning.
  --warning-hours WARNING-HOURS
                        warning length, unit is hour.
  --csv-dump-path CSV_DUMP_PATH
                        Dump the result CSV file to the path if it is
                        specified. Use in warning.

Command Reference ​

Table 1 gs_dbmind component forecast parameters

Parameter

Description

Value Range

-h, --help

Help information

-

action

Action parameter

  • show: displays results.
  • clean: clears results.

-c, --conf

Configuration directory

-

--metric-name

Specifies the metric name to be displayed, which is used for filtering.

-

--host

Specifies the service IP address and port number, which is used for filtering.

-

--start-time

Timestamp of the start time, in milliseconds. Alternatively, the date and time format is %Y-%m-%d %H:%M:%S.

Positive integer or date and time format

--end-time

Timestamp of the start time, in milliseconds. Alternatively, the date and time format is %Y-%m-%d %H:%M:%S.

Timestamp of the start time, in milliseconds. Alternatively, the date and time format is %Y-%m-%d %H:%M:%S.

--retention-days

Number of days retaining results

Non-negative real number

Troubleshooting ​

  • Considering the actual service and model prediction effect, you are advised to set the trend prediction duration to a value greater than 3600 seconds. (If the metric collection period is 15 seconds, the number of data records collected is 240.) Otherwise, the prediction effect will deteriorate, and the service will be abnormal when the data volume is extremely small. The default value is 3600 seconds.
  • After the parameters in the configuration file are reset, you need to restart the service process for the settings to take effect.