Replies: 3 comments 5 replies
-
|
When you have time, I’d appreciate your feedback 🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I don't believe that leveraging other components to solve this issue is a reasonable solution. Here's why:
|
Beta Was this translation helpful? Give feedback.
5 replies
-
|
Does anyone know of a tool that can monitor the number of Redis keys in real time and visualize it in a graph? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear Seata Community 👋
We are observing performance bottlenecks related to the delayed deletion of
global_tableentries, particularly in high-concurrency environments, as highlighted in issue #6615, #7334. The accumulation of transaction records impacts TPS and disk space utilization. I propose two key areas for optimization, focusing on enhancing the efficiency ofglobal_tablecleanup within the Transaction Coordinator.1. Enhance TC Internal Multi-threaded Cleanup
Currently, the
global_tablecleanup process within a single instance, managed by scheduled thread pools, may not fully leverage available CPU resources. WhilequeryLimitallows adjusting the batch size for queries, the overall cleanup throughput can be limited if the deletion logic itself is not sufficiently parallelized across multiple threads or if the batching is not optimally tuned. This leads to a backlog of completed transactions inglobal_table(e.g.Committed,Rollbackedstates ).Proposed Solution:
I suggest enhancing the internal multi-threaded cleanup mechanism within the
DefaultCoordinatorto achieve more granular task distribution and dynamic tuning ofqueryLimitin conjunction with the number of cleanup threads.global_tableinto logical segments. Each segment would then be assigned to a dedicated thread within an expanded cleanup thread pool. This segmentation could be based onqueryLimit(defaulting to 1000) determines the number of records fetched in a single database query. When increasing the number of cleanup threads, it's crucial to re-evaluate this parameter.queryLimitreduces database round trips but can lead to longer-held database locks and increased transaction log growth. With multiple threads, a moderately smallerqueryLimitper thread might be more effective, as it allows for more frequent, smaller transactions, reducing contention and improving overall database concurrency.diagram(Enhance TC Internal Multi-threaded Cleanup)
graph TD subgraph Seata TC Instance A --> B{Scheduled Thread Pool}; B -- Thread 1 --> C1(Cleanup Task: Query & Delete Batch A); B -- Thread 2 --> C2(Cleanup Task: Query & Delete Batch B); B -- Thread N --> CN(Cleanup Task: Query & Delete Batch N); end C1 --> D[global_table]; C2 --> D; CN --> D;Real world Example: Elasticsearch Index Merging
Elasticsearch, a distributed search and analytics engine, stores data in indices, which are further divided into shards. Each shard consists of multiple segments (immutable Lucene indices). As new data is indexed, new segments are created. To optimize storage and search performance, Elasticsearch performs background "merge" operations. These merges combine smaller segments into larger ones, reclaiming disk space and improving query efficiency. This process is highly parallelized; multiple threads or processes can concurrently merge different sets of segments within a shard or across multiple shards.
2. Database-level Sharding for
global_tableEven with optimized internal multi-threading, a single underlying
global_tablein a monolithic database can become a bottleneck under extreme transaction volumes. The sheer volume of data can lead to I/O contention, increased query latency, and prolonged lock times during cleanup operations, regardless of how efficiently the TC requests deletions.Proposed Solution:
Implement database-level sharding for the
global_table. This involves distributing theglobal_tabledata across multiple physical database instances or logical partitions. This approach fundamentally scales out the storage and processing capacity for transaction logs.Instead of all Seata TC instances writing to and reading from a single
global_table, a sharding middleware would intercept database operations and route them to the appropriate shard.global_table, suitable candidates include:xid(transactionId): Using transactionId of thexidcan distribute transactions evenly across shards, preventing hotspots.global_tablemanagement.diagram (Database-level Sharding for global_table)
graph TD subgraph Seata_Client_Application TM end subgraph Seata_TC_Cluster TC1 TC2 TCN end subgraph Sharding_Middleware SM end subgraph Sharded_Database DB1 DB2 DBN end TM --> TC1 TM --> TC2 TM --> TCN TC1 --> SM TC2 --> SM TCN --> SM SM --> DB1 SM --> DB2 SM --> DBN DB1 --> DB1 DB2 --> DB2 DBN --> DBNHow we use: Apache ShardingSphere
Apache ShardingSphere is a widely used open-source ecosystem that provides data sharding, distributed transactions, and database governance capabilities. It can be seamlessly integrated with Seata. For
global_tablesharding, ShardingSphere-JDBC (a lightweight Java JDBC driver) can be configured to:xid.global_table(e.g.,INSERT,SELECT,DELETE), ShardingSphere intercepts the SQL, parses it, and routes it to the correct physical database instance(s) based on the sharding key in the SQL.By leveraging ShardingSphere, the
global_tablecan be scaled horizontally, allowing multiple TC instances to operate on different data subsets in parallel, thereby alleviating the cleanup bottleneck and improving overall system performance and scalability.Beta Was this translation helpful? Give feedback.
All reactions