MXS-2350: Allow lazy connection creation

The lazy connection creation reduces the burden that short sessions place
on the backend servers. This also prevents the problems caused by early
disconnections that happen when only one server is used but multiple
connections are created. This does not solve the problem (MXS-619) but it
does mitigate it to acceptable levels.

This commit also adds a change to the weighting algorithm that prefers
existing connections over unopened ones. This helps avoid the
flip-flopping that happens when the absolute scores are very similar. The
hard-coded value might need to be tuned once testing is done.
This commit is contained in:
Markus Mäkelä
2019-02-28 21:17:17 +02:00
parent 95317725ce
commit 24ea222ed6
7 changed files with 52 additions and 15 deletions

View File

@ -133,6 +133,7 @@ public:
private:
RWSplitSession(RWSplit* instance,
MXS_SESSION* session,
const Config& config,
mxs::SRWBackends backends,
mxs::RWBackend* master);
@ -290,7 +291,7 @@ private:
uint64_t m_sent_sescmd; /**< ID of the last sent session command*/
uint64_t m_recv_sescmd; /**< ID of the most recently completed session
* command */
ExecMap m_exec_map; /**< Map of COM_STMT_EXECUTE statement IDs to
ExecMap m_exec_map; /**< Map of COM_STMT_EXECUTE statement IDs to
* Backends */
std::string m_gtid_pos; /**< Gtid position for causal read */
wait_gtid_state m_wait_gtid; /**< State of MASTER_GTID_WAIT reply */