Skip to main content
VeloDB Cloud 26.x is based on Apache Doris 4.x. See Version Mapping.

Workload Group

A Workload Group controls how queries and supported loading tasks share CPU, memory, and read throughput within a cluster. Use it to limit a background workload or reserve resources for higher-priority queries without creating a separate cluster.

Workload Groups share some process resources, including caches and RPC thread pools. A busy group can still affect another group's latency. Use separate clusters when workloads need independent compute and cache capacity.

Cloud scope and prerequisites​

This guide applies to SaaS and BYOC warehouses. VeloDB Cloud manages the host environment, including CPU resource-control configuration. You do not need to create CGroup directories, edit frontend or backend configuration files, or restart services to follow these SQL procedures.

  • Connect to the warehouse with a warehouse SQL administrator to create, alter, or drop a Workload Group.
  • Choose an existing cluster. The FOR <cluster_name> clause is required for CREATE, ALTER, and DROP WORKLOAD GROUP.
  • Grant users access to both the cluster and the Workload Group before assigning queries to it. Workload Group access does not grant table or database privileges.
  • Each cluster has its own Workload Group configuration. ALTER WORKLOAD GROUP changes properties within the named cluster. It cannot move a group to another cluster.

The SQL examples below use cluster analytics, Workload Group reporting, and existing SQL user 'report_user'@'%'. Replace these names with your own values.

The examples and property model on this page apply to Core 26.1.3. For older Core releases, check the available property names before migrating scripts that use older Apache Doris controls.

Create a Workload Group​

CREATE WORKLOAD GROUP IF NOT EXISTS reporting FOR analytics
PROPERTIES (
"min_cpu_percent" = "10%",
"max_cpu_percent" = "50%",
"min_memory_percent" = "10%",
"max_memory_percent" = "40%",
"max_concurrency" = "10",
"max_queue_size" = "20",
"queue_timeout" = "30000"
);

This example reserves a share of resources under contention and caps the group's CPU and memory use. It also admits up to 10 concurrent query slots and allows additional queries to wait. The values are starting points for testing, not recommended limits for every workload.

For complete syntax, see CREATE WORKLOAD GROUP. You can also manage Workload Groups in the Console.

Properties​

The defaults in these tables are Core 26.1.3 SQL creation defaults. Existing groups and groups created through the Console can have different configured values. Use SHOW WORKLOAD GROUPS to inspect them.

CPU and memory​

PropertyDefaultAccepted valuesEffect
min_cpu_percent0%Integer 0%-100%Minimum CPU share under contention. A group can use more when capacity is idle, up to its maximum.
max_cpu_percent100%Integer 1%-100%Maximum CPU allocation for work controlled by the group.
min_memory_percent0%Integer 0%-100%Minimum memory allocation used when resolving contention between groups.
max_memory_percent100%Integer 1%-100%Upper memory allocation for the group. Memory pressure can cause eligible operations to spill or queries to be canceled.
memory_low_watermark75%Integer 1%-100%Low watermark used by memory-pressure handling, relative to the group's memory limit.
memory_high_watermark85%Integer 1%-100%High watermark used by memory-pressure handling, relative to the group's memory limit.
slot_memory_policynonenone, fixed, dynamicControls query-slot memory allocation. none uses the query's memory limit, capped by the group limit. fixed apportions memory by configured slots. dynamic adjusts allocation using active slots and memory pressure.

For each cluster, the sum of min_cpu_percent across groups must not exceed 100%. The same rule applies to min_memory_percent. Each minimum must be no greater than its corresponding maximum. The low memory watermark must be no greater than the high watermark.

Memory percentages apply to memory available to the backend process, rather than the host's full physical memory. A group limit does not include every allocation made by shared process components. Leave capacity for system activity and measure query success rates when lowering a limit.

Concurrency and queueing​

PropertyDefaultAccepted valuesEffect
max_concurrency2147483647Integer 0-2147483647Maximum concurrent query slots. A query normally uses one slot. Queries that request more slots consume more of this capacity.
max_queue_size0Integer 0-2147483647Maximum waiting queries. 0 rejects queries that cannot run immediately.
queue_timeout0Integer 0-2147483647, in millisecondsMaximum queue wait when positive, also bounded by the query timeout. 0 uses the query timeout rather than adding a separate queue deadline.

Setting max_concurrency to 0 prevents queued queries from being admitted to run. Use a positive concurrency limit for normal operation. For query slots and frontend queue scope, see concurrency control and queueing.

Scan threads and read throughput​

PropertyDefaultAccepted valuesEffect
scan_thread_num-1-1 or a positive 32-bit integerLocal scan thread count. -1 uses the service's backend setting.
max_remote_scan_thread_num-1-1 or a positive 32-bit integerMaximum remote scan threads.
min_remote_scan_thread_num-1-1 or a positive 32-bit integerMinimum remote scan threads.
read_bytes_per_second-1-1 or a positive 64-bit integerRead-throughput limit in bytes per second for each managed local scan directory, including spill directories. -1 disables this limit.
remote_read_bytes_per_second-1-1 or a positive 64-bit integerRemote read-throughput limit in bytes per second for the group's backend process. -1 disables this limit.

Set both remote scan thread properties together, and keep the minimum no greater than the maximum. Leave both at -1 to use service-managed values.

Read limits apply to the controlled read paths. They are not a warehouse-wide cap on network traffic or storage I/O. Multiple compute nodes, local scan directories, caching, and background tasks affect the relationship between a property value and aggregate cluster metrics.

Grant access and assign queries​

A warehouse SQL administrator can grant access to the cluster and group:

GRANT USAGE_PRIV ON COMPUTE GROUP analytics TO 'report_user'@'%';
GRANT USAGE_PRIV ON WORKLOAD GROUP 'reporting' TO 'report_user'@'%';

The user can then select the cluster and group:

USE @analytics;
SET workload_group = 'reporting';

To persist a default Workload Group for the current user, run:

SET PROPERTY 'default_workload_group' = 'reporting';

The workload_group session variable takes precedence over the user's default. Without either assignment, queries use the built-in normal group. A default or session assignment does not create a group or grant its USAGE privilege. The selected cluster must contain the named group.

For account administration and privilege syntax, see Warehouse Users and Roles and GRANT.

Inspect configuration and resource use​

View the groups visible to your SQL user:

SHOW WORKLOAD GROUPS;
SHOW WORKLOAD GROUPS LIKE 'reporting';

Inspect the selected group's ID and cluster:

SELECT ID, NAME, COMPUTE_GROUP,
MIN_CPU_PERCENT, MAX_CPU_PERCENT,
MIN_MEMORY_PERCENT, MAX_MEMORY_PERCENT,
MAX_CONCURRENCY, MAX_QUEUE_SIZE, QUEUE_TIMEOUT
FROM information_schema.workload_groups
WHERE NAME = 'reporting';

If the name appears in multiple clusters, use the COMPUTE_GROUP field to identify the correct row. Record its ID. Replace 12345 below with that ID to inspect per-backend resource measurements:

SELECT BE_ID, WORKLOAD_GROUP_ID,
MEMORY_USAGE_BYTES / 1024 / 1024 AS memory_mib,
CPU_USAGE_PERCENT,
LOCAL_SCAN_BYTES_PER_SECOND / 1024 / 1024 AS local_scan_mib_per_second,
REMOTE_SCAN_BYTES_PER_SECOND / 1024 / 1024 AS remote_scan_mib_per_second
FROM information_schema.workload_group_resource_usage
WHERE WORKLOAD_GROUP_ID = 12345;

These measurements describe the group's accounted resource use. They are not the total usage of the entire backend process. See Workload Group resource usage for fields and access requirements.

Alter or drop a Workload Group​

Change only the properties that need adjustment:

ALTER WORKLOAD GROUP reporting FOR analytics
PROPERTIES (
"max_cpu_percent" = "40%",
"max_memory_percent" = "30%"
);

Inspect the configured values again, then observe the workload after the change has reached the compute nodes. Changing limits can affect running queries. Metadata propagation is asynchronous, so do not infer success from an immediate resource sample alone.

Before dropping a group, stop or reassign its workloads and update user defaults and workload policies that refer to it. Reset any current test session to normal:

SET workload_group = 'normal';
SET PROPERTY 'default_workload_group' = 'normal';
DROP WORKLOAD GROUP reporting FOR analytics;

The built-in normal group cannot be dropped. A group referenced by a user's default property also cannot be dropped until the property is updated.

See ALTER WORKLOAD GROUP and DROP WORKLOAD GROUP.

Validate resource controls​

Test limits with representative queries in a dedicated test group. Keep a baseline, change one control at a time, and compare query latency, failures, queueing, and per-backend group measurements. Do not clear host caches, change operating-system settings, or restart managed services for these checks.

The examples below alter the existing reporting group on analytics. They illustrate settings to evaluate, not expected performance results.

Example 1: Limit memory​

Compare memory use and query success rates
ALTER WORKLOAD GROUP reporting FOR analytics
PROPERTIES (
"max_memory_percent" = "20%",
"max_concurrency" = "3",
"max_queue_size" = "10",
"queue_timeout" = "30000"
);

Run a representative memory-intensive query with controlled concurrency. Observe MEMORY_USAGE_BYTES, spills, and memory-limit failures. If failures increase, reduce concurrency, tune the query, or raise the memory limit within the available capacity. Lowering the memory limit does not guarantee that every query succeeds.

Example 2: Limit CPU​

Compare a background group's CPU use with interactive-query latency
ALTER WORKLOAD GROUP reporting FOR analytics
PROPERTIES (
"min_cpu_percent" = "10%",
"max_cpu_percent" = "30%"
);

Run a CPU-intensive workload and inspect the group's CPU_USAGE_PERCENT alongside the latency of other groups. A backend-process or cluster CPU total can exceed the group's cap because it includes work outside the group. CPU allocation percentages do not promise a particular query latency.

Example 3: Limit local reads​

Observe local scan throughput with a read limit
ALTER WORKLOAD GROUP reporting FOR analytics
PROPERTIES ("read_bytes_per_second" = "104857600");

This value is 100 MiB per second for each controlled local scan directory. Run a representative scan and inspect LOCAL_SCAN_BYTES_PER_SECOND. Cached reads, directory count, and other work can make process or cluster I/O differ from the configured value.

Example 4: Limit remote reads​

Observe remote throughput while scanning an external source
ALTER WORKLOAD GROUP reporting FOR analytics
PROPERTIES ("remote_read_bytes_per_second" = "104857600");

Run an existing external-table query or an S3 table-valued function using your authorized source. Inspect REMOTE_SCAN_BYTES_PER_SECOND for the group on each backend. Actual throughput also depends on the source, network, caching, and query parallelism. Short measurement intervals can show fluctuations.

Upstream example observations​

The upstream Apache Doris Workload Group guide contains ClickBench examples for memory, CPU, local reads, and remote reads. The upstream examples used self-managed hosts and older property names. Their observations help illustrate the difference between group accounting and process measurements:

Example environmentReported observation
One frontend and one backend, 96 CPU cores and 375 GB memory, three concurrent ClickBench Q29 queries.The group accounted for roughly 5.8 GB while the process used roughly 7.7 GB before a memory cap. Applying the historical cap caused memory-limit query failures.
One frontend and one backend, 96 CPU cores, ClickBench Q29.A historical 10% CPU cap reduced query CPU use to approximately 9-10 cores.
One frontend and one backend, 96 CPU cores, ClickBench data.A historical 100 MiB/s local-read cap produced group samples around 98 MiB/s, while host-level measurements differed.
One frontend and one backend on a 16-core, 64 GB host, a 10-million-row ClickBench file in S3.A historical 100 MiB/s remote-read cap produced fluctuating samples, including 56, 131, and 111 MiB/s.

The upstream examples do not identify all engine-build, storage, and query settings. These are upstream observations, not VeloDB Cloud measurements or capacity guarantees. The current SQL examples above use the Core property model described on this page.

Migrate older property names​

For the Core behavior described here, use min_cpu_percent and max_cpu_percent for CPU controls, and min_memory_percent and max_memory_percent for memory controls. The older properties cpu_share, cpu_hard_limit, memory_limit, and enable_memory_overcommit are not accepted as current Workload Group properties. The tag property is also deprecated. Bind a group with the FOR <cluster_name> clause instead.

There is no one-to-one numeric conversion from CPU weights to reserved percentages. Review the whole cluster's allocation before migrating scripts. You do not need to switch a cluster-wide CPU soft-limit or hard-limit mode to use the current minimum and maximum properties together.

Common errors​

SymptomProbable cause and resolution
Must specify compute group via 'FOR <compute_group>' in cloud mode.Add the target cluster to the CREATE, ALTER, or DROP statement.
A property is not supported or is deprecated.Check the Core version and use the current property names. Do not reuse a self-managed example containing cpu_share or memory_limit.
A minimum exceeds its maximum or the sum of minimum allocations exceeds 100%.Inspect the groups on the same cluster and rebalance minimum allocations before retrying.
Access is denied or the group cannot be found.Verify the active cluster, group name, cluster USAGE, and Workload Group USAGE privileges.
A queue is full or a query times out while waiting.Check max_concurrency, max_queue_size, queue_timeout, query slots, query timeout, and resource pressure. See query queueing.
Group creation reports a group-count limit, or resource allocation reports Resource temporarily unavailable.Consolidate unnecessary groups and thread pools. Contact VeloDB Cloud support before changing managed service or operating-system limits.
CPU or I/O measurements exceed the expected cap.Compare the group's per-backend measurements with the control's scope. Process totals include other work, and local I/O limits apply per directory. If group measurements still do not reflect the settings after propagation, contact VeloDB Cloud support.

Cost and cleanup​

Validation queries consume compute and can read billable external storage or transfer data. Use a representative sample and stop the test when you have enough measurements. Restore the group's previous settings or remove the test group after reassigning users and sessions. Pause or delete any cluster created only for testing. See billing.

See also​