The diagnosis feature of PolarDB for MySQL integrates with Database Autonomy Service (DAS). On the Autonomy Center tab, you can enable the autonomy service. Then, if an exception occurs in a database, DAS automatically analyzes root causes, provides optimization or stop-loss suggestions, and runs optimization or stop-loss tasks. Optimization tasks are allowed based on your authorization.

Prerequisites

The product edition must be Cluster Edition or Single Node.Archive Database does not support this feature. For more information about the three editions, see Product editions.

Considerations

Only the PolarDB for MySQL clusters whose product type is pay-as-you-go support automatic scale-out and automatic scale-in. The subscription clusters do not support automatic scale-out or automatic scale-in. For more information about product types, see Create a PolarDB for MySQL cluster.

Procedure

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. On the Clusters page, find the cluster for which you want to enable the autonomy service, and then click the cluster ID.
  4. In the left-side navigation pane, choose Diagnostics and Optimization > Diagnosis.
  5. On the page that appears, click the Autonomy Center tab.
    Tab
  6. In the upper-right corner of the tab, click Automomous function swtich.
    Settings
  7. In the displayed dialog box, turn on Enable Autonomy Service.
    Note After you turn on Enable Autonomy Service, the system automatically performs diagnostics tests, and provides suggestions for you to optimize SQL statements.
    Autonomy service
  8. Specify the following parameters:
    • Automatic Index Creation and Deletion: After you turn on Enable Autonomy Service, the SQL Diagnostics feature is automatically enabled. You can click Enable Automatic Index Creation to enable the system to automatically create indexes, or click Enable Automatic Index Deletion to enable the system to automatically delete indexes.
    • Automatic Throttling: You can specify conditions to trigger automatic SQL throttling. If the specified conditions are met, automatic SQL throttling is triggered.
      Note For example, automatic SQL throttling is triggered if the following conditions are met during the period specified by the Current limiting period parameter: CPU utilization is greater than 80%, Number of active sessions is greater than 64, and Duration is greater than 2 minutes. The Current limiting period parameter specifies the period during which SQL throttling is allowed, and the default period is from 00:00 to 23:59. The system automatically starts to check whether the conditions are met again when the feature of automatic SQL throttling is triggered. If the problem persists, the system automatically rolls back the throttling operation. After automatic SQL throttling is triggered, the duration that the throttling operation lasts for does not exceed the value of the Maximum current limiting time parameter. For more information, see Automatic SQL throttling.
    • Automatic Scale-out: You can specify conditions to trigger automatic scale-out. If the specified conditions are met, scale-out is automatically triggered.
      Table 1. Parameters related to automatic scale-out
      Parameter Description
      Average CPU utilization The threshold for triggering automatic scale-out. If Average CPU utilization is greater than or equal to the specified value, automatic scale-out is triggered.
      Maximum Specifications The upper limit of the cluster specification that can be automatically scaled to. The system upgrades the cluster specification of PolarDB to the maximum specification by one level at a time. For example, the system upgrades the cluster specification from 4 cores to 8 cores and then to 16 cores.
      Note
      • The sclaing does not affect the existing data.
      • When the system changes cluster specifications, PolarDB clusters may experience transient connection errors for a few seconds and some operations are unavailable. Make sure that your application can automatically connect to PolarDB for MySQL clusters.
      Maximum number of read-only nodes The maximum number of read-only nodes that can be automatically scaled to. After automatic scale-out is triggered, the read-only nodes of PolarDB are added one after one until the upper limit is reached.
      Observation Window DAS checks whether the conditions for triggering automatic scale-out or scale-in are met in a periodical manner. If the CPU utilization reaches the specified threshold, DAS triggers automatic scale-out upon the end of the observation window. By default, if the CPU utilization is greater than 70% for more than 50% of the observation window, DAS triggers automatic scale-out upon the end of the observation window.
      Quiescent Period The minimum interval between two automatic scale-in or scale-out operations. During a quiescent period, DAS continues checking whether the conditions for triggering automatic scale-out or scale-in are met, but does not trigger automatic scale-out or scale-in even if the specified conditions are met. A quiescent period and an observation window may end at the same time. In this case, if the specified conditions are met within the observation window, DAS triggers automatic scale-out or scale-in when the quiescent period and the observation window end.
    • Automatic Scale-in: After you enable this feature, if the CPU utilization is lower than 30% for more than 99% of an observation window, DAS triggers automatic scale-in. DAS scales in the PolarDB cluster by one level at a time until the cluster specification is reduced to the original specification.
  9. Click Determine.