OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.2.2

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.2.2
    iconOceanBase Database
    SQL - V 4.2.2
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Configure cgroups

    Last Updated:2026-04-15 08:27:13  Updated
    Share
    What is on this page
    Background information
    Precautions and limitations
    Procedure
    Step 1: Configure the cgroup system directory
    Step 2: Deploy OceanBase Database
    Step 3: Establish a soft link to OceanBase Database
    Step 4: Enable the cgroup feature
    What to do next
    References

    folded

    Share

    In OceanBase Database V4.2.0, worker threads and most background threads are identified by tenant, and network threads are shared. You can configure control groups (cgroups) to control the CPU usage of tenants.

    Background information

    Before you configure cgroups, we recommend that you learn about the concept of cgroup first. For more information, see Overview.

    Precautions and limitations

    • Resource isolation considerably compromises performance. We recommend that you do not use the cgroup feature to isolate tenant resources in the following scenarios:

      • Single-tenant scenarios that have only one tenant in the cluster.

      • Scenarios where tenants are associated with each other. For example, multiple tenants serve different microservices, resulting in an upstream and downstream relationship among the tenants.

      • Small-scale tenant scenarios where each tenant has two or four CPU cores.

    • If the operating system of the OBServer node is Alibaba Cloud Linux, to use the cgroup feature, the operating system version must be 4.1.9 or later.

    • The cgroup feature compromises performance of OceanBase Database. Therefore, weigh the isolation benefits and performance loss before you enable the cgroup feature.

    Procedure

    Step 1: Configure the cgroup system directory

    Notice

    • You must configure the cgroup system directory before you install OceanBase Database.
    • You must obtain the root user privileges when you configure the cgroup system directory.

    This topic describes how to configure the cgroup system directory on one OBServer node. If the OceanBase cluster consists of multiple OBServer nodes, you must configure the cgroup system directory on each OBServer node.

    1. Log on as the admin user to the OBServer server.

    2. Run the following command to mount the /sys/fs/cgroup directory.

      Note

      If the /sys/fs/cgroup directory already exists, skip this step.

      [admin@xxx /]$ sudo mount -t tmpfs cgroups /sys/fs/cgroup
      

      Here, cgroups is a user-defined name for identification when you view the mount information.

      The mounting result is as follows:

      $df
      Filesystem      1K-blocks       Used Available Use% Mounted on
      /               293601280   28055472 265545808  10% /
      /dev/v01d      2348810240 2113955876 234854364  91% /data/1
      /dev/v02d      1300234240 1170211208 130023032  91% /data/log1
      shm              33554432          0  33554432   0% /dev/shm
      /dev/v04d       293601280   28055472 265545808  10% /home/admin/logs
      cgroups         395752136          0 395752136   0% /sys/fs/cgroup
      
    3. Create a directory named /sys/fs/cgroup/cpu and change its owner. This directory is used for mounting the cpu subsystem later.

      [admin@xxx /]$ sudo mkdir /sys/fs/cgroup/cpu
      
      [admin@xxx /]$ sudo mkdir /sys/fs/cgroup/blkio
      

      Note

      If the /sys/fs/cgroup/cpu directory already exists and is empty, skip this step.

    4. Mount the cpu subsystem.

      Create a directory hierarchy named cpu, attach the cpu subsystem to this hierarchy, and mount this hierarchy to the /sys/fs/cgroup/cpu directory.

      [admin@xxx /]$ sudo mount -t cgroup -o cpu cpu /sys/fs/cgroup/cpu
      
    5. Create a subdirectory named oceanbase and change its owner to admin.

      [admin@xxx /]$ sudo mkdir /sys/fs/cgroup/cpu/oceanbase
      
      [admin@xxx /]$ sudo chown admin:admin -R /sys/fs/cgroup/cpu/oceanbase
      
    6. Run the following commands to set the oceanbase directory to inherit the CPU and memory configurations from the upper-level directory and set the lower-level directories of the oceanbase directory to automatically inherit its configurations.

      Notice

      At present, the cpu, cpuset, and cpuacct subsystems cannot be mounted to different directories. If they are mounted to different directories on your server, clear the mounting information and then run the sudo mount -t cgroup -o cpuset,cpu,cpuacct cpu /sys/fs/cgroup/cpu command to mount them to the same directory.

      Confirm that the cpu, cpuset, and cpuacct subsystems are mounted to the same directory and then run the following commands:

      [admin@xxx /]$ sudo sh -c "echo `cat /sys/fs/cgroup/cpu/cpuset.cpus` > /sys/fs/cgroup/cpu/oceanbase/cpuset.cpus"
      
      [admin@xxx /]$ sudo sh -c "echo `cat /sys/fs/cgroup/cpu/cpuset.mems` > /sys/fs/cgroup/cpu/oceanbase/cpuset.mems"
      
      [admin@xxx /]$ sudo sh -c "echo 1 > /sys/fs/cgroup/cpu/oceanbase/cgroup.clone_children"
      

    Step 2: Deploy OceanBase Database

    After the cgroup system directory is configured, you can deploy OceanBase Database.

    Step 3: Establish a soft link to OceanBase Database

    After OceanBase Database is installed, establish a soft link between the installation directory of OceanBase Database and the cgroup system directory.

    1. Log on as the admin user to the OBServer node.

    2. Manually establish a soft link between the installation directory of OceanBase Database and the cgroup system directory.

      [admin@xxx /home/admin]$ cd /home/admin/oceanbase/
      
      [admin@xxx /home/admin]
      $ ln -sf /sys/fs/cgroup/cpu/oceanbase/ cgroup
      
      [admin@xxx /home/admin]
      $ ln -sf /sys/fs/cgroup/blkio/oceanbase/ cgroup
      

      Here, /home/admin/oceanbase/ is the installation directory of OceanBase Database.

      The execution result is as follows:

      [admin@xxx /home/admin/oceanbase]
      $ll cgroup
      lrwxrwxrwx 1 admin admin 29 Dec  8 11:09 cgroup -> /sys/fs/cgroup/cpu/oceanbase/
      lrwxrwxrwx 1 admin admin 29 Dec  8 11:09 cgroup -> /sys/fs/cgroup/blkio/oceanbase/
      
    3. Restart the observer process.

      You must first stop the observer process and then restart it. For more information, see Restart a node.

      If the observer process detects that a soft link has been established, it will create the cgroup directory in the /sys/fs/cgroup/cpu/oceanbase/ directory.

      After the observer process is restarted, you can view the cgroup directory structure in the installation directory /home/admin/oceanbase of OceanBase Database.

    4. Log on to the sys tenant of the cluster and query the view V$OB_CGROUP_CONFIG or GV$OB_CGROUP_CONFIG to view the cgroup configuration for each OBServer node.

      SELECT * FROM oceanbase.GV$OB_CGROUP_CONFIG;
      

    Step 4: Enable the cgroup feature

    In OceanBase Database, the cluster-level enable_cgroup parameter specifies whether to enable the cgroup feature for the OBServer node. The default value is True, which specifies to enable this feature. If this feature is disabled, perform the following steps to enable it.

    1. Log on to the sys tenant of the cluster as the root user.

    2. Run the following command to enable the cgroup feature:

      obclient> ALTER SYSTEM SET enable_cgroup = true;
      

      or

      obclient> ALTER SYSTEM SET enable_cgroup = 1;
      

      or

      obclient> ALTER SYSTEM SET enable_cgroup = ON;
      

    What to do next

    After you configure the cgroup system directory and enable the cgroup feature, in the case of emergencies, you can control the utilization of CPU resources in a tenant by using the cpu.cfs_period_us, cpu.cfs_quota_us, and cpu.shares files in the directory of the tenant. Generally, we recommend that you do not implement resource isolation in this way.

    We recommend that you use the files in the cgroup system directory to call the CREATE_CONSUMER_GROUP subprogram in the DBMS_RESOURCE_MANAGER package to create resource groups for user-level or SQL statement-level resource isolation. For more information about user-level and SQL statement-level resource isolation, see the following topics:

    • Configure user-level resource isolation

    • Configure SQL statement-level resource isolation

    References

    Clear cgroup configurations

    Previous topic

    Resource isolation overview
    Last

    Next topic

    Calibrate the disk performance
    Next
    What is on this page
    Background information
    Precautions and limitations
    Procedure
    Step 1: Configure the cgroup system directory
    Step 2: Deploy OceanBase Database
    Step 3: Establish a soft link to OceanBase Database
    Step 4: Enable the cgroup feature
    What to do next
    References