Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a Concurrency Control Rule

Updated on 2024-10-14 GMT+08:00

Scenarios

You can create rules to control concurrent execution of SQL statements by specifying SQL type, keywords, and maximum concurrency. To maintain better performance at high concurrency, SQL statements that meet the specified SQL type and keyword and exceed the maximum concurrency will not be executed.

High SQL concurrency can be caused by the following factors:

  • A sharp increase in requests: Concurrent SQL statements of a certain type surge due to cache penetration and abnormal calls.
  • Stacked slow queries: If a large number of SQL statements without indexes are called, many slow SQL statements will be generated, affecting services.

Supported Versions

Concurrency Control is available to the RDS for MySQL versions listed in Table 1.

Table 1 Supported versions

Major Version

Minor Version (Primary Instance)

Minor Version (Read Replica)

Setting Rules for Read Replicas Separately

5.6

≥ 5.6.50.3

≥ 5.6.51.6

Not supported

5.7

≥ 5.7.31.4

≥ 5.7.37.1

≥ 5.7.38.221000

8.0

≥ 8.0.25.1

≥ 8.0.25.1

Not supported

In some versions, concurrency control rules are not applied to requests sent by user root. For details, see Table 2.

NOTE:

If your instance running 5.7.43.231000 or later or 8.0.28.231000 or later, concurrency control rules will be applied to user root. To disable concurrency control for user root, contact customer service.

Table 2 Versions in which requests from root are not limited by concurrency control rules

Major Version

Minor Version (Primary Instance)

5.6

≥ 5.6.51.4

5.7

5.7.33.1 ≤ Version < 5.7.43.231000

8.0

8.0.25.1 ≤ Version < 8.0.28.231000

To achieve better performance at high concurrency, you are advised to upgrade your DB instance to the latest minor version. For details about how to upgrade a minor version, see Upgrading a Minor Version.

Constraints

  • A maximum of 100 concurrency control rules can be configured.
  • Only SELECT, UPDATE, DELETE, and INSERT statements are supported for concurrency control.
  • INSERT statements are only supported for RDS for MySQL 5.7 (5.7.44.240100 or later) and 8.0 (8.0.32.240100 or later) for concurrency control. To use this function, contact customer service to apply for required permissions.
  • If a SQL statement matches multiple concurrency control rules, only the most recently added rule is applied.
  • SQL statements that have been executed before a concurrency control rule is added are not counted.
  • If the replication delay is too long, adding or deleting a concurrency control rule for a read replica does not take effect immediately.
  • Concurrency control rules are not applied to system tables.
  • Concurrency control rules are not applied to SQL statements not used for data query, such as select sleep(***);.
  • Concurrency control rules are not applied to stored procedures, triggers, or functions.
  • You can run the following SQL statement through DAS to view the execution of concurrency control rules: select * from information_schema.rds_sql_filter_info;
  • Too many concurrency control rules affect the database performance. Delete unnecessary rules after using them.
  • Concurrency control rules are not applied to system databases.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the target DB instance name.
  5. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  6. Choose SQL Explorer > Concurrency Control.
  7. Toggle on the concurrency control switch .

    NOTE:

    Concurrency control rules take effect only after concurrency control is enabled.

  8. Click Add Rule. Configure the parameters listed in Table 3.

    Figure 1 Adding a rule (entering keywords)
    Figure 2 Adding a rule (generating keywords from a SQL statement)
    Table 3 Parameter description

    Parameter

    Description

    SQL Type

    There are four options: SELECT, UPDATE, DELETE, and INSERT.

    Keyword

    A maximum of 128 keywords (case-insensitive) are supported. You can specify keywords in either of the following ways:

    • Manually: Take select~a as an example. select and a are two keywords contained in a concurrency control rule. The keywords are separated by a tilde (~). In this example, the rule restricts the execution of only the SQL statements containing keywords select and a.
    • Using SQL statements: You can enter a SQL statement and then click Generate Keyword. The generated keywords are for reference only. Exercise caution when using them.

    SQL statements match the keywords from first to last. For example, if one rule contains the keyword a~and~b, the statement *** a>1 and b>2 can match the keyword, but *** b>2 and a>1 cannot.

    Empty characters before and after each keyword will be ignored, for example, spaces, '\n', '\r', and '\t'.

    Max. Concurrency

    If the number of concurrent SQL statements matching the keyword exceeds this limit, the SQL statements will not be executed. The value ranges from 0 to 1,000,000,000.

    Kill existing sessions that match this rule

    If this option is selected, all sessions generated by users subject to this concurrency control rule will be killed.

    For details about the versions where user root is not subject to concurrency control rules, see Table 2.

  9. Confirm the settings and click OK.

Follow-up Operations

To delete a concurrency control rule, locate it in the rule list and click Delete in the Operation column. In the displayed dialog box, click OK.

Figure 3 Deleting a rule

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback