Description:
Hi,
I want to use max_idle_server_connection config with 'Mysql Router', but it seems not working.
I'm using 3db instances(v8.0.30) with multi-primary mode, and 2mysql router instances(v8.0.30).
config options, values and descriptions are here
1. idle_timeout : 1000
Seconds to keep the idling connection in the collection pool before closing it
2. max_idle_server_connections : 30
Connections to keep open after the client disconnects
I expected least 30 connections are remain until 1000sec.
But not works for me.
Any help?
Thanks.
How to repeat:
1. start mysql router with bootstrap
router-0> mysqlrouter --bootstrap "{user}:{pwd}@{ip}:{port}" --user mysqlrouter
2. edit mysqlrouter.conf
##mysqlrouter.conf###
[DEFAULT]
...
...
#add connection_pool section
[connection_pool]
idle_timeout=1000
max_idle_server_connections=30
3. restart mysql router
router-0> systemctl restart mysqlrouter
4. get connection_pool config
router-0> curl -s localhost:{http_port}/api/20190715/connection_pool/main/config
{
maxIdleServerConnections": 30,
"idleTimeoutInMs": 1000000
}
5. make enough client connection, and get db connected threads
//in my case, I used "sysbench" for traffic
db-0> mysql -e"show status where variable_name like 'thread%'";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 0 |
| Threads_connected | 46 |
| Threads_created | 346 |
| Threads_running | 6 |
+-------------------+-------+
db-1> mysql -e"show status where variable_name like 'thread%'";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 0 |
| Threads_connected | 44 |
| Threads_created | 317 |
| Threads_running | 26 |
+-------------------+-------+
db-2> mysql -e"show status where variable_name like 'thread%'";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 0 |
| Threads_connected | 44 |
| Threads_created | 311 |
| Threads_running | 11 |
+-------------------+-------+
router-0> curl -s localhost:{http_port}/api/20190715/routes/bootstrap_rw/connections
{
"items": [
{
"bytesFromServer": 892287,
"bytesToServer": 113477,
"sourceAddress": "*****:*****",
"destinationAddress": "*****:*****",
"timeStarted": "2022-11-03T06:04:03.612788Z",
"timeConnectedToServer": "2022-11-03T06:04:03.613119Z",
"timeLastSentToServer": "2022-11-03T06:04:07.354824Z",
"timeLastReceivedFromServer": "2022-11-03T06:04:07.354010Z"
},
{
"bytesFromServer": 894063,
"bytesToServer": 109876,
"sourceAddress": "*****:*****",
"destinationAddress": "*****:*****",
"timeStarted": "2022-11-03T06:04:03.620025Z",
"timeConnectedToServer": "2022-11-03T06:04:03.620893Z",
"timeLastSentToServer": "2022-11-03T06:04:07.355070Z",
"timeLastReceivedFromServer": "2022-11-03T06:04:07.354212Z"
},
{
"bytesFromServer": 791357,
"bytesToServer": 102485,
"sourceAddress": "*****:*****",
"destinationAddress": "*****:*****",
"timeStarted": "2022-11-03T06:04:03.620489Z",
"timeConnectedToServer": "2022-11-03T06:04:03.621262Z",
"timeLastSentToServer": "2022-11-03T06:04:07.335298Z",
"timeLastReceivedFromServer": "2022-11-03T06:04:07.335011Z"
},
...
]
}
6. stop making client connection, and get db connected threads
db-0> mysql -e"show status where variable_name like 'thread%'";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 6 |
| Threads_connected | 3 |
| Threads_created | 346 |
| Threads_running | 2 |
+-------------------+-------+
db-1> mysql -e"show status where variable_name like 'thread%'";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 8 |
| Threads_connected | 1 |
| Threads_created | 317 |
| Threads_running | 2 |
+-------------------+-------+
db-2> mysql -e"show status where variable_name like 'thread%'";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 8 |
| Threads_connected | 1 |
| Threads_created | 311 |
| Threads_running | 2 |
+-------------------+-------+
router-0> curl -s localhost:{http_port}/api/20190715/routes/bootstrap_rw/connections
{
"items": []
}
Description: Hi, I want to use max_idle_server_connection config with 'Mysql Router', but it seems not working. I'm using 3db instances(v8.0.30) with multi-primary mode, and 2mysql router instances(v8.0.30). config options, values and descriptions are here 1. idle_timeout : 1000 Seconds to keep the idling connection in the collection pool before closing it 2. max_idle_server_connections : 30 Connections to keep open after the client disconnects I expected least 30 connections are remain until 1000sec. But not works for me. Any help? Thanks. How to repeat: 1. start mysql router with bootstrap router-0> mysqlrouter --bootstrap "{user}:{pwd}@{ip}:{port}" --user mysqlrouter 2. edit mysqlrouter.conf ##mysqlrouter.conf### [DEFAULT] ... ... #add connection_pool section [connection_pool] idle_timeout=1000 max_idle_server_connections=30 3. restart mysql router router-0> systemctl restart mysqlrouter 4. get connection_pool config router-0> curl -s localhost:{http_port}/api/20190715/connection_pool/main/config { maxIdleServerConnections": 30, "idleTimeoutInMs": 1000000 } 5. make enough client connection, and get db connected threads //in my case, I used "sysbench" for traffic db-0> mysql -e"show status where variable_name like 'thread%'"; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 0 | | Threads_connected | 46 | | Threads_created | 346 | | Threads_running | 6 | +-------------------+-------+ db-1> mysql -e"show status where variable_name like 'thread%'"; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 0 | | Threads_connected | 44 | | Threads_created | 317 | | Threads_running | 26 | +-------------------+-------+ db-2> mysql -e"show status where variable_name like 'thread%'"; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 0 | | Threads_connected | 44 | | Threads_created | 311 | | Threads_running | 11 | +-------------------+-------+ router-0> curl -s localhost:{http_port}/api/20190715/routes/bootstrap_rw/connections { "items": [ { "bytesFromServer": 892287, "bytesToServer": 113477, "sourceAddress": "*****:*****", "destinationAddress": "*****:*****", "timeStarted": "2022-11-03T06:04:03.612788Z", "timeConnectedToServer": "2022-11-03T06:04:03.613119Z", "timeLastSentToServer": "2022-11-03T06:04:07.354824Z", "timeLastReceivedFromServer": "2022-11-03T06:04:07.354010Z" }, { "bytesFromServer": 894063, "bytesToServer": 109876, "sourceAddress": "*****:*****", "destinationAddress": "*****:*****", "timeStarted": "2022-11-03T06:04:03.620025Z", "timeConnectedToServer": "2022-11-03T06:04:03.620893Z", "timeLastSentToServer": "2022-11-03T06:04:07.355070Z", "timeLastReceivedFromServer": "2022-11-03T06:04:07.354212Z" }, { "bytesFromServer": 791357, "bytesToServer": 102485, "sourceAddress": "*****:*****", "destinationAddress": "*****:*****", "timeStarted": "2022-11-03T06:04:03.620489Z", "timeConnectedToServer": "2022-11-03T06:04:03.621262Z", "timeLastSentToServer": "2022-11-03T06:04:07.335298Z", "timeLastReceivedFromServer": "2022-11-03T06:04:07.335011Z" }, ... ] } 6. stop making client connection, and get db connected threads db-0> mysql -e"show status where variable_name like 'thread%'"; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 6 | | Threads_connected | 3 | | Threads_created | 346 | | Threads_running | 2 | +-------------------+-------+ db-1> mysql -e"show status where variable_name like 'thread%'"; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 8 | | Threads_connected | 1 | | Threads_created | 317 | | Threads_running | 2 | +-------------------+-------+ db-2> mysql -e"show status where variable_name like 'thread%'"; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 8 | | Threads_connected | 1 | | Threads_created | 311 | | Threads_running | 2 | +-------------------+-------+ router-0> curl -s localhost:{http_port}/api/20190715/routes/bootstrap_rw/connections { "items": [] }