Help Center> GaussDB(for MySQL)> FAQs> Database Connections> What Is the Maximum Number of Connections to a GaussDB(for MySQL) Instance?
Updated on 2023-10-19 GMT+08:00

What Is the Maximum Number of Connections to a GaussDB(for MySQL) Instance?

GaussDB(for MySQL) does not have constraints on the number of connections. This number is determined by the default value and value range of the DB engine. For example, you can set max_connections and max_user_connections in a parameter template to configure the maximum number of connections for a GaussDB(for MySQL) instance.

Changing the Maximum Number of Connections

The number of connections can be changed online. For details, see Modifying a Parameter Template.

You can run commands to change the maximum number of connections.

  1. Check the maximum number of connections:

    show global variables like 'max_connections';

  2. Change the value of max_connections under mysqld in the my.cnf file.

    [mysqld]

    max_connections = 1000

About max_connections

max_connections indicates the maximum number of clients that can be connected at the same time. If this parameter is set to default, it is related to the instance memory (unit: GB). The calculation formula is as follows:

Estimated value of max_connections = Available node memory/Estimated memory occupied by a single connection

  • Available node memory = Total memory – Memory occupied by the buffer pool – 1 GB (mysqld process, OS, and monitoring program)
  • Estimated memory usage of a single connection (single_thread_memory) = thread_stack (256 KB) + binlog_cache_size (32 KB) + join_buffer_size (256 KB) + sort_buffer_size (256 KB) + read_buffer_size (128 KB) + read_rnd_buffer_size (256 KB) ≈ 1 MB

The following table lists the default values of max_connections for different memory specifications.

Table 1 Max_connections for different memory specifications

Memory (GB)

Connections

512

100,000

384

80,000

256

60,000

128

30,000

64

18,000

32

10,000

16

5,000

8

2,500

4

1,500

2

800

Database Connections FAQs

more