Updated on 2024-11-29 GMT+08:00

Overview

Doris Multi-Tenancy

Doris multi-tenancy is built on top of the Workload Group Resource soft limit of the kernel. Workloads are managed by group to ensure flexible allocation and control of memory and CPU resources. Each tenant role of a user can have many workload groups. You can manage CPU, memory, concurrency, and queues with this model shown in Figure 1.

Multiple tenants can be created and managed only on FusionInsight Manager when Kerberos authentication is enabled for the cluster (the cluster is in security mode).

Figure 1 Doris tenant model

After a user is associated with a tenant, all query tasks submitted by the user are added to the workload group. You can limit the percentage of CPU and memory resources on BE nodes for a single query and configure a soft memory limit for the workload group.

When cluster resources are insufficient, the system automatically stops several query tasks that occupy memory the most in the group. If the resources used by a workload group exceed the preset limit, multiple workloads share idle resources in the cluster and use resources more than the limit. This ensures stable execution of query tasks. In addition, the query queuing function is introduced to relieve system pressure in heavy-load scenarios. When creating a workload group, you can set the maximum number of concurrent queries to queue the exceeding queries.

Associations Between Doris Tenant Roles and Users

On the FusionInsight Manager service configuration and tenant management pages, you can create tenants, associate tenants with services, configure tenant resources, and associate tenants with users. The following figure shows the association between roles and users on the Manager and Doris sides.

A user, a tenant role, and a workload group are in one-on-one relationship. A user can have multiple permission roles.

Table 1 lists the Doris tenant resource configurations supported by the current version.

Table 1 tenant resource configuration

Configuration

Value Range

Description

Remarks

CPU Quota Usage

1 to 100

Weight of CPU resources that can be used by a tenant

The value specifies a relative ratio that is valid during resource competition. For example, if this value for tenant A is 10 and that for tenant B is 20, the CPU resources can be used by the query tasks of tenant A is one third of total resources, that is, 10/(10 + 20). If tenant C starts query tasks and its CPU quota usage is 30, a CPU quota of tenant A is one sixth of total resources, that is, 10/(10 + 20 + 30).

Memory Quota

1% to 70%

Maximum proportion of memory that can be used by a tenant

The available memory of a tenant is calculated as follows: Physical memory x mem_limit x Memory quota. The upper limit is 70%. By default, a tenant in normal state occupies 30% of memory.

Concurrencies

1 to 2147483647

Maximum number of concurrent query tasks that a tenant can run

This parameter specifies the maximum number of tasks on each FE node. For example, if the number of concurrent SQL statements is set to 1 and the Doris has three FE nodes, the maximum number of SQL statements that can be executed in a cluster is 3.

Queue Length

0 to 2147483647

Maximum number of waiting query tasks

Excessive SQL statements are queued. When the queue is full, newly submitted queries are rejected.

Waiting Duration

0 to 2147483647

Maximum waiting duration of a tenant query task

If the query waiting duration exceeds the value of this parameter, the query is rejected. The unit is millisecond.

Soft Memory Limit

  • On
  • Off

Whether a tenant can use more memory resources than the limit

  • If this function is disabled, the system immediately cancels the tasks that occupy the most memory in the tenant groups when detecting that the memory usage of the tenant exceeds the upper limit.
  • If this function is enabled and the cluster has idle memory resources, the tenant can use the system memory more than the limit. The tasks that occupy the most memory in the tenant groups are canceled only when cluster resources are insufficient.