From 422d6f5ab2a7f5ac4b51b4d5b2aa52e36c9e3999 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 19 Nov 2015 18:28:29 +0200 Subject: [PATCH] Updated readwritesplit default values The combination of only one slave being used and the slave_selection_criteria being LEAST_CURRENT_OPERATIONS can possibly cause a connection pileup on one slave server. This would skew the query distribution heavily towards the first available slave even if multiple slave were being used. Having the maximum number of slave servers to be equal to the total amount of available slaves allows for a more even and responsive distribution of the query traffic. --- Documentation/Routers/ReadWriteSplit.md | 2 +- server/modules/routing/readwritesplit/readwritesplit.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/Routers/ReadWriteSplit.md b/Documentation/Routers/ReadWriteSplit.md index c6e5f456f..18a7aa3d4 100644 --- a/Documentation/Routers/ReadWriteSplit.md +++ b/Documentation/Routers/ReadWriteSplit.md @@ -52,7 +52,7 @@ passwd= ### `max_slave_connections` -**`max_slave_connections`** sets the maximum number of slaves a router session uses at any moment. Default value is `1`. +**`max_slave_connections`** sets the maximum number of slaves a router session uses at any moment. The default is to use all available slaves. max_slave_connections= diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 67669d1fa..a02f46c05 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -698,12 +698,12 @@ createInstance(SERVICE *service, char **options) router->rwsplit_config.rw_max_sescmd_history_size = 0; } - /** - * Set default value for max_slave_connections and for slave selection - * criteria. If parameter is set in config file max_slave_connections - * will be overwritten. + /** + * Set default value for max_slave_connections as 100%. This way + * LEAST_CURRENT_OPERATIONS allows us to balance evenly across all the + * configured slaves. */ - router->rwsplit_config.rw_max_slave_conn_count = CONFIG_MAX_SLAVE_CONN; + router->rwsplit_config.rw_max_slave_conn_count = nservers; if (router->rwsplit_config.rw_slave_select_criteria == UNDEFINED_CRITERIA) {