[MXS-4374] Not Balanced Connection Between Master & Slave From monitor Created: 2022-10-31 Updated: 2022-12-02 Resolved: 2022-12-02 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | Monitor, readwritesplit |
| Affects Version/s: | 6.4.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | febriyant | Assignee: | markus makela |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | connection, maxscale, readwritesplit | ||
| Environment: |
CentOS 7 |
||
| Attachments: |
|
| Description |
| Comments |
| Comment by markus makela [ 2022-10-31 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by febriyant [ 2022-11-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
hi @markus
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2022-11-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Are the connections still not balanced after the restart? If they are not, you can try enabling info level logging by adding log_info=true under the [maxscale] section. The info logging is verbose so be ready to disable it if it starts to affect the performance adversely. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by febriyant [ 2022-11-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
hi Markus ok I will apply the config ``` log_info=true ``` I will provide the log soon | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by febriyant [ 2022-11-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
hi markus I hope you got some clue currently I already disabled again for config log_info=true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2022-11-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What's the value of wait_timeout on the backend database servers? Looks like there's a lot of connections that are idle and they keep opening new connections due to timeouts that happen on the backends. The value of connection_timeout should be lower than the value of wait_timeout in the database. I think the behavior is explained by some changes that were added to newer versions of MaxScale. The routing is slightly smarter when it comes to opening connections for commands that modify the session state: if there are no connections, it prefers to pick a server labeled as Master to avoid the situation where the result would be different if it were executed on a server labeled as Slave. The log shows that this happens as the clients send a COM_PING command that wakes the connection up and forces a new connection to be executed. As it prefers the current Master server, it naturally ends up having more connections. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by febriyant [ 2022-11-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
hi markus
this on maxscale
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2022-11-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ah, my bad. I didn't realize the full config was there and saw only the first page of it. This does confirm my theory that the reason why the connections pile up on one server is due to the COM_PING triggering a reconnection. So far this seems like expected behavior and it's not a bug. I'd recommend lowering connection_timeout to a value below wait_timeout. You should also configure your client-side connection pools to close connections before either of the two timeouts are reached. Having MaxScale constantly reopen connections is quite wasteful. The ideal configuration is to have the timeouts be as such:
For example, you should set the maximum lifetime of a client-side connection pool to 30 seconds, the connection_timeout in MaxScale to 60 seconds and wait_timeout in MariaDB to 90 seconds. This way the closing of the connection is always initiated in the "right" order and only error conditions in the client application cause other timeouts to be triggered. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by febriyant [ 2022-11-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi markus thanks for update Let me test first on dev env. I will give the results ASAP Thank you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2022-11-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
OK, I'll keep it in Needs Feedback state until we hear back from you. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by febriyant [ 2022-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
hi markus I have already changed the configuration maxscale and database and on database is wait_timeout = 3600 and interactive_timeout = 3600 but I still need more time for monitoring, because we have some big process end of this months I hope you can still open this ticket Thank you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2022-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sure, we'll keep it open. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by febriyant [ 2022-12-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Markus thanks for the support so you can close this ticket Thank You |