DEV Community

Cong Li
Cong Li

Posted on

GBASE数据库 | GBase 8c Distributed Fault Analysis and Handling - Connection Count Parameter Configuration

GBase 8c database (GBase 8c数据库) is a high-performance, enterprise-grade distributed database with multi-mode and polymorphic features. It supports multiple storage modes, such as row-store, column-store, and in-memory, and can be deployed in single-node, primary-standby, or distributed architectures. The GBase 8c installation package can be downloaded from the official Nanda General website at GBase 8c Download.

This article provides an analysis of common memory issues encountered during the installation and operation of GBase 8c database (GBase 8c数据库) in a distributed environment, along with corresponding solutions, to serve as a reference for users working with GBase 8c.


Problem Scenario

During pre-production stress testing, users observed an insufficient number of connections. After adjusting the dn max_connections = 50000 parameter and restarting the cluster, the DN node failed to start, resulting in the following error:

Image description


Problem Analysis

The error message indicates that the gtm proxy: GLOBAL_ALL_PROCS too large error occurred, meaning the max_connections value exceeded the GLOBAL_ALL_PROCS macro limit. The value of this macro is set to 32766.

The formula for this parameter is:

max_connections + max_prepared_transactions * (num_internal_locks_partitions in TWOPHASE_PART) + system auxiliary threads + system background threads ≤ GLOBAL_ALL_PROCS
Enter fullscreen mode Exit fullscreen mode

The database will only start successfully when the formula is satisfied.


Problem Resolution

To resolve the issue, we adjusted the max_connections value to 10000 and restarted the database cluster. The issue was resolved, and the cluster successfully started.


Extended Problem Considerations

In real-world scenarios, the number of connections might exceed the set limits (this usually happens in poorly designed environments where active or concurrent connections are much lower than expected). When connection limits are not sufficient, the following measures should be taken:

1) Optimize the Business Connection Pool:

  • Reduce idle connections and release resources efficiently.

2) Optimize Slow Queries:

  • Enhance the query performance to improve connection pool utilization.

3) Manage Business Connection Counts:

  • Use load balancing techniques like F5 (hardware load balancing), HAProxy (software load balancing), or JDBC load balancing to manage the number of connections.

Important Notes

  • Each node (CN, DN, and GTM nodes) must not exceed the GLOBAL_ALL_PROCS limit of 32766.
  • Properly managing connections across all nodes in the GBase 8c distributed system is crucial for maintaining optimal performance and avoiding errors.

Knowledge Insights

When the Coordinator node receives requests from the application side to access the database, it uses the GTM client library to communicate with the GTM to obtain the transaction's GXID (Global Transaction ID) and SNAPSHOT, and report the transaction status.

The GTM itself accepts connections through its port. For each communication between the Coordinator and DataNode, a GTM THREAD is created to handle the communication between the GTM, DataNode, and Coordinator. During this communication, the thread maintains a transaction snapshot and sends the transaction GXID. The thread only exits after the transaction is completed.

In practice, GTM does not directly communicate with the Coordinator but does so through the GTM proxy for more efficient communication. A single GTM proxy can handle requests from hundreds of Coordinators. The GTM proxy reduces the interaction frequency between the Coordinator and GTM by scanning all requests from the Coordinator and grouping them before sending to the GTM.


Conclusion

Properly configuring connection parameters and managing the interaction between different components in a distributed GBase 8c environment is crucial for ensuring smooth operation. By understanding and handling connection limits, optimizing resources, and using load balancing techniques, you can prevent performance issues and ensure stable operation. GBase 8c database's (GBase 8c 数据库) flexibility and scalability make it an ideal choice for enterprises looking for a robust distributed database solution.

Top comments (0)