Skip to content

Feature/user resource quota#18202

Open
hongzhi-gao wants to merge 1 commit into
apache:masterfrom
hongzhi-gao:feature/user-resource-quota
Open

Feature/user resource quota#18202
hongzhi-gao wants to merge 1 commit into
apache:masterfrom
hongzhi-gao:feature/user-resource-quota

Conversation

@hongzhi-gao

Copy link
Copy Markdown
Contributor

Description

Add a unified user-level resource quota framework so multi-tenant workloads can set per-user CPU / memory / temp-disk / disk-IO limits with min (guarantee) + max (cap), while staying compatible with existing THROTTLE QUOTA.

SQL & model

  • New SQL: SET / SHOW / DELETE USER QUOTA
  • Resources: CPU, MEMORY, TEMP_DISK (capacity, Byte), DISK_IO (rate, reuse throttle)
  • Read/write dimensions (read_* / write_*); keep SET/SHOW THROTTLE QUOTA and map cpu/memread_cpu_max / read_memory_max
  • Keep config key quota_enable (enabled semantics; compatible with THROTTLE/SPACE)

Runtime enforcement (DataNode-local)

  • Unified UserResourceQuotaManager.acquire/release on query (DriverScheduler) and write paths
  • Capacity scheduling: user max → node capacity → minGap (prefer users below min when contended)
  • Unconfigured / unlimited users still join node capacity + minGap (unlimited ≠ skip scheduling)
  • Lowering max does not kill in-flight usage; new acquires are rejected until Used ≤ new max
  • DELETE USER QUOTA clears config only and keeps in-flight inUse until tokens release
  • Acquire reject logs concrete reason (user max / node capacity / minGap) with user, op, resource

Cluster SHOW & defaults

  • SHOW USER QUOTA: NodeID = all Running DataNodes; DN reports inUse via heartbeat; CN aggregates; lost nodes omitted
  • dn_quota_temp_disk_bytes default = min(100GiB, ΣdataDirs.totalSpace/10) at startup; explicit config overrides
  • Quota push: current async + retry; design targets metadata lease / ClusterCachePropagator when available

Tests

  • UT: limiter (max/minGap/unlimited/lower-max/clear-keeps-inUse/reject reasons), SHOW multi-DN expand, parse smoke, plan SerDe
  • IT: IoTDBUserResourceQuotaIT (SET/SHOW/DELETE, throttle mapping, lower max, NodeID)

This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR
  • iotdb-core/datanode/.../quotas/UserResourceQuotaManager
  • iotdb-core/datanode/.../quotas/CapacityResourceLimiter / LimiterAcquireResult
  • iotdb-core/datanode/.../quota/ShowUserResourceQuotaTask / SetUserResourceQuotaTask / DeleteUserResourceQuotaTask
  • iotdb-core/confignode/.../ClusterQuotaManager
  • iotdb-core/confignode/.../quota/SetUserResourceQuotaPlan / DeleteUserResourceQuotaPlan
  • iotdb-core/node-commons/.../quota/*
  • iotdb-protocol/thrift-{commons,datanode,confignode} (quota + heartbeat usage snapshot)
  • integration-test/.../IoTDBUserResourceQuotaIT

@hongzhi-gao hongzhi-gao force-pushed the feature/user-resource-quota branch 2 times, most recently from 014945f to 04d45c8 Compare July 16, 2026 04:28
…UOTA.

Introduce per-user min/max quotas for read/write CPU, memory, temp disk
and disk IO, with ConfigNode persistence, DataNode acquire/release,
THROTTLE compatibility, and related tests. Usage is reported via a
dedicated low-frequency reportUserResourceUsage RPC (not main heartbeat);
disk_io/temp_disk use fixed long units (bytes/sec and bytes).
@hongzhi-gao hongzhi-gao force-pushed the feature/user-resource-quota branch from 04d45c8 to 3bba33b Compare July 16, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant