[MXS-2347] New servers are not taken into use mid-session Created: 2019-02-25 Updated: 2022-04-22 Resolved: 2022-04-22 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | Core |
| Affects Version/s: | None |
| Fix Version/s: | 22.08.0 |
| Type: | New Feature | Priority: | Major |
| Reporter: | markus makela | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
When a new server is added to a service, it is only used by new sessions. This is a problem if the connection lifetimes are very long or if client side connection pooling is in use. Adding extra servers to a service as a response to higher than average load provides no benefits if those servers aren't taken into use as soon as possible. |
| Comments |
| Comment by markus makela [ 2019-12-02 ] |
|
The cleanest way to do this would be to somehow force faster recycling of client-side connection pools. This would retain the static nature of the session level configuration and it would remove the need for checks for new servers at all points. |
| Comment by markus makela [ 2022-01-28 ] |
|
A somewhat crude and brute-force way of doing this would be to introduce a "restart" command for the session. This could be implemented by first calling the close() method of the Session's downstrem Endpoint followed by a connect() call. This would recreate the router and filter sessions which would effectively reload the configuration for active sessions. This is not ideal as it causes the TCP connections to be recycled but it should preserve the session state as that is now stored in the client protocol which is tied to the client DCB. |
| Comment by markus makela [ 2022-04-22 ] |
|
Added the maxctrl reload session <id> and maxctrl reload sessions commands that can be used to restart the session internally, taking a newer configuration into use. This allows a new set of servers to be taken into use by long-running client connections. The way the commands were implemented was to open a second internal session before closing the first one in order to minimize the amount of problems this command could create. Given that these commands also reload other configurations than just the servers, this can be used to add filters or change the router configuration of an open session. This also means that the behavior could change in a way that the client application is not expecting: if extreme changes are done to the service configuration (e.g. the router type is changed, extra filters are added or removed), the semantics of the connection can also change. MaxScale tries to prevent this by doing the change only when the connection is idle but the administrator doing the changes must be aware of whether the old session is compatible with the new configuration. For example, removing causal_reads from a readwritesplit service makes it so that reads are no longer synchronized and some applications might not work with this. |