AnalyticDB for MySQL physically divides computing resources into multiple resource groups. Each resource group has independent CPU, memory, query queues, job types, and configuration parameters. Computing resources are fully isolated among different resource groups. This prevents impacts on core business caused by complex computing or emergencies, and allows you to properly allocate resources to maximize cluster performance and meet multi-tenancy and hybrid workload requirements. This topic describes the types and scenarios of resource groups in Data Lakehouse Edition.
Each cluster has a default resource group named user_default
. If no other resource groups exist, all queries are executed by the default resource group.
Functionalities of resource groups
Isolation of computing resources among different queries: Different users or applications may have different requirements for computing resources. You can submit different queries to different resource groups to isolate computing resources for the queries. This ensures that latency-sensitive interactive jobs are not affected by time-consuming and resource-intensive batch processing jobs. For more information, see the "Specify a resource group to execute queries" section of this topic.
Batch processing: The default resource group is suitable for interactive real-time analysis. If you want to implement batch processing without affecting the response speed of real-time analysis, you can create a job resource group to perform batch processing. For more information, see Create and manage a resource group.
Scheduled or automatic scaling of resources: If your business traffic periodically fluctuates, you can configure elastic scaling plans to add resources to or remove resources from resource groups. For more information, see Elastic resource scaling.
You can also configure the maximum and minimum resources that can be used by a resource group. In this case, the resource group performs automatic scaling within the specified resource range based on your business requirements. For more information, see Multi-cluster scaling models and Create and manage a resource group.
Priority scheduling of queries: Each resource group has a set of priority queues. You can configure query priorities to allow specific queries to be preferentially executed. For more information, see Priority queue and concurrency of interactive resource groups and Priority queues of job resource groups.
Workload management: You can manage workloads based on resource groups. For example, if the execution duration of a query exceeds the threshold in a resource group, the system resubmits the query to another resource group for execution. This prevents other queries in the original resource group from being blocked. For more information, see Overview.
Specify a resource group to execute queries
Each cluster has a default resource group named user_default
. If no other resource groups exist, all queries are executed by the default resource group. If you have resource isolation requirements among queries, you can create resource groups and specify a resource group for each type of queries.
The following table describes how to specify a resource group to execute queries when you submit a XIHE SQL statement, Spark SQL statement, or Spark application.
Use Java Database Connectivity (JDBC) to submit an SQL statement | Use one of the following methods to specify a resource group to execute queries:
If you use the preceding methods to specify multiple resource groups, the resource groups take effect in the following order based on priority: hint-based resource group, associated resource group, and default resource group. |
Submit a Spark SQL statement or Spark application on the Job Development page | Select a resource group on the Job Development page in the AnalyticDB for MySQL console. In this case, you cannot specify a resource group by adding a hint to the SQL statement or associating the resource group with the database account that you use. |
Use spark-submit, Notebook, or SDK to submit a Spark application |
|
Use API operations to submit a Spark application | Use the ResourceGroupName parameter in the SubmitSparkApp operation to specify a resource group. |