tencent cloud

TDSQL-C for MySQL

Release Notes and Announcements
Release Notes
Product Announcements
Beginner's Guide
Product Introduction
Overview
Strengths
Use Cases
Architecture
Product Specifications
Instance Types
Product Feature List
Database Versions
Regions and AZs
Common Concepts
Use Limits
Suggestions on Usage Specifications
Kernel Features
Kernel Overview
Kernel Version Release Notes
Optimized Kernel Version
Functionality Features
Performance Features
Security Features
Stability Feature
Analysis Engine Features
Inspection and Repair of Kernel Issues
Purchase Guide
Billing Overview
Product Pricing
Creating Cluster
Specification Adjustment Description
Renewal
Payment Overdue
Refund
Change from Pay-as-You-Go to Yearly/Monthly Subscription
Change from Pay-as-You-Go to Serverless Billing
Value-Added Services Billing Overview
Viewing Billing Statements
Getting Started
Database Audit
Overview
Viewing Audit Instance List
Enabling Audit Service
Viewing Audit Logs
Log Shipping
Post-Event Alarm Configuration
Modifying Audit Rule
Modifying Audit Service
Disabling Audit Service
Audit Rule Template
Viewing Audit Task
Authorizing Sub-User to Use Database Audit
Serverless Service
Serverless Introduction
Creating and Managing a Serverless Cluster
Elastic Scaling Management Tool
Serverless Resource Pack
Multi-AZ Deployment
Configuration Change
FAQs
Serverless Cost Estimator
Operation Guide
Operation Overview
Switching Cluster Page View in Console
Database Connection
Instance Management
Configuration Adjustment
Instance Mode Management
Cluster Management
Scaling Instance
Database Proxy
Account Management
Database Management
Database Management Tool
Parameter Configuration
Multi-AZ Deployment
GD
Backup and Restoration
Operation Log
Data Migration
Parallel Query
Columnar Storage Index (CSI)
Analysis Engine
Database Security and Encryption
Monitoring and Alarms
Basic SQL Operations
Connecting to TDSQL-C for MySQL Through SCF
Tag
Practical Tutorial
Classified Protection Practice for Database Audit of TDSQL-C for MySQL
Upgrading Database Version from MySQL 5.7 to 8.0 Through DTS
Usage Instructions for TDSQL-C MySQL
New Version of Console
Implementing Multiple RO Groups with Multiple Database Proxy Connection Addresses
Strengths of Database Proxy
Selecting Billing Mode for Storage Space
Creating Remote Disaster Recovery by DTS
Creating VPC for Cluster
Data Rollback
Solution to High CPU Utilization
How to Authorize Sub-Users to View Monitoring Data
White Paper
Security White Paper
Performance White Paper
Troubleshooting
Connection Issues
Performance Issues
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Multi-Availability Zone APIs
Other APIs
Audit APIs
Database Proxy APIs
Backup and Recovery APIs
Parameter Management APIs
Billing APIs
serverless APIs
Resource Package APIs
Account APIs
Performance Analysis APIs
Data Types
Error Codes
FAQs
Basic Concepts
Purchase and Billing
Compatibility and Format
Connection and Network
Features
Console Operations
Database and Table
Performance and Log
Database Audit
Between TDSQL-C for MySQL and TencentDB for MySQL
Service Agreement
Service Level Agreement
Terms of Service
TDSQL-C Policy
Privacy Policy
Data Privacy and Security Agreement
General References
Standards and Certifications
Glossary
Contact Us

Binlog Purging Performance Optimization

PDF
Focus Mode
Font Size
Last updated: 2024-11-14 10:42:57

Overview

In a database, binlog is a log file used to record database operations, including addition, deletion, and modification. The binlog files increase over time, occupying a large disk space, so they should be regularly purged. However, binlog purging may conflict with normal binlog rotation and write transactions. Particularly when there are many binlog files, performance fluctuation is easily caused by binlog purging. Through analysis on the scenarios of purging binlog files, the Tencent Cloud kernel team has optimized the binlog purging performance.
The optimization addresses the LOCK_index conflict between binlog purging and binlog rotation, preventing failure to obtain the lock and continue writing binlogs in binlog rotation.
Currently, when an index lock is held by binlog purging, if binlog rotation is required after the binlog size reaches 256 MB but the lock cannot be obtained, binlog writing will stop until the index lock is obtained. The main optimization for this issue is that if the index lock cannot be obtained, binlog rotation is not performed and binlogs continue to be written into the current binlog file. Attempts will be made constantly to obtain the index lock and binlog rotation will be performed only after the index lock is obtained.
The optimization reduces the volume of information read from binlog files to be purged, thereby reducing locks.
The binlog purging process requires reading the GTID information from all binlogs to be purged and then writing it into the mysql.gtid executed table. Therefore, the exclusive lock of GTID is held during the entire purging period, resulting in that normal transactions cannot obtain the GTID lock. The main optimization for this issue is that GTID information is read only from the last binlog file in the binlog list, reducing the holding time of the GTID lock and decreasing its impact on normal transactions.
The maximum size of a single binlog file has been increased to 10 GB, significantly reducing the number of times of binlog rotation.
The default binlog size is 256 MB. Under a load of 5,000 QPS, binlog rotation is performed approximately every 1.4s, each taking 10-20 ms. Currently, the max_binlog_size can be increased from 256 MB to 10 GB (open-source MySQL supports up to 1 GB). Under the same load, rotation is now performed every 56s, reducing the frequency of obtaining the index lock. The max_binlog_size parameter is set to 1 GB in the current policy and can be further adjusted based on business load requirements.

Supported Versions

Kernel version 3.1.12 or later for TDSQL-C for MySQL 8.0.
Kernel version 2.1.12 or later for TDSQL-C for MySQL 5.7.

Use Cases

This feature is applicable to scenarios where binlog purging may cause lock contention and block binlog writing in case of many binlog files.

Use Instructions

This feature is used with parameters. Set txsql_binlog_rotate_try_lock_index and txsql_binlog_rotate_try_lock_log to ON, and set txsql_binlog_purge_check_file_count to 10 to use this feature. Detailed parameter descriptions are as follows:
Name
Global or Not
Type
Default Value
Value Range
Description
txsql_binlog_rotate_try_lock_index
Global
bool
ON
ON/OFF
When it is set to ON, if the lock of the index file cannot be obtained in binlog rotation, the current rotation will be abandoned.
txsql_binlog_rotate_try_lock_log
Global
bool
ON
ON/OFF
When it is set to ON, if the lock of the binlog file cannot be obtained in binlog rotation, the current rotation will be abandoned.
txsql_binlog_purge_check_file_count
Global
ulonglong
10
0-UINT64_MAX
The binlog purging process requires obtaining the binlog file name from the binlog index file. If there are many binlog files, this operation is time-consuming. Normally, only one binlog file name is required. This parameter restricts the number of file names obtained. 0 indicates no limit. It is generally set to 10.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback