§ Thread Pool & Connection Parameters
§ Thread Pool
By default, GreatSQL creates one worker thread per client connection (one-thread-per-connection). Since system resources are limited and creating and destroying threads also incurs additional overhead, under this mode the overall database throughput will drop noticeably once the number of connections spikes suddenly.
GreatSQL introduces the thread pool (Thread pool) feature, which avoids throughput degradation caused by resource contention when the number of connections spikes suddenly, and makes GreatSQL performance more stable.
For details, see: Thread Pool
§ Checking Whether the Thread Pool Feature Is Enabled
greatsql> SHOW GLOBAL VARIABLES LIKE "thread_handling";
+-----------------+-----------------+
| Variable_name | Value |
+-----------------+-----------------+
| thread_handling | pool-of-threads |
+-----------------+-----------------+
1 row in set (0.01 sec)
2
3
4
5
6
7
As shown in the output, when thread_handling is pool-of-threads, the thread pool feature is enabled.
§ How to Enable the Thread Pool Feature
Set the thread_handling option to pool-of-threads in the my.cnf configuration file and restart the GreatSQL service to enable the thread pool feature:
[mysqld]
thread_handling = "pool-of-threads"
2
§ Connection Parameters
In GreatSQL, the common connection parameters include:
max_connect_errors: the maximum number of connection errors allowed for a single usermax_connections: the maximum number of connections allowed for the instancemax_user_connections: the maximum number of connections allowed for a userconnect_timeout: the connection timeout for a userdelayed_insert_timeout: the timeout for delayed insertinteractive_timeout: the timeout for interactive connections- ......
Use SHOW GLOBAL VARIABLES LIKE to view the relevant parameter values.
SHOW GLOBAL VARIABLES LIKE "%max_connect%";
During development, it is recommended to set these parameters to improve the performance of connecting to GreatSQL.
max_connect_errors: recommended value 1000max_connections: recommended value 1024max_user_connections: recommended value is half of themax_connectionsparameterconnect_timeout: recommended value 10 secondsdelayed_insert_timeout: recommended value 300 secondsinteractive_timeout: recommended value 600 seconds- ......
Use SET GLOBAL to modify these parameter values.
SET GLOBAL max_connect_errors=1000;
Scan the QR code to follow our WeChat Official Account
