From 38b10f05a224d29c723c033dec0820f977aa8026 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 23 Sep 2016 12:36:48 -0700 Subject: [PATCH] For now, disable persistent connections and the "max_connections" setup warning Summary: Ref T11672. At low loads, this causes us to use more connections, which is pushing some installs over the default limits. Rather than trying to walk users through changing `max_connections`, `open_files_limit`, `fs.file-max`, `ulimit`, etc., just put things back for now. After T11044 we should have headroom to use persistent connections within the default limits on all reasonable systems.. Test Plan: Loaded Phabricator, poked around. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11672 Differential Revision: https://secure.phabricator.com/D16591 --- .../check/PhabricatorMySQLSetupCheck.php | 34 ------------------- .../storage/lisk/PhabricatorLiskDAO.php | 8 ++++- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/src/applications/config/check/PhabricatorMySQLSetupCheck.php b/src/applications/config/check/PhabricatorMySQLSetupCheck.php index f42009057a..1990e7f09f 100644 --- a/src/applications/config/check/PhabricatorMySQLSetupCheck.php +++ b/src/applications/config/check/PhabricatorMySQLSetupCheck.php @@ -44,40 +44,6 @@ final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { ->addMySQLConfig('max_allowed_packet'); } - $max_connections = self::loadRawConfigValue('max_connections'); - - // A common default is 150, but we're fairly liberal about the number of - // connections we open and it's easy for us to run far over this limit. - - $warning_threshold = 256; - if ($max_connections < $warning_threshold) { - $message = pht( - 'MySQL is configured with a small "%s" (%d) limit, which may cause '. - 'connection failures long before any resources near exhaustion. '. - 'There is normally very little benefit to enforcing a connection '. - 'limit, and most installs should increase it substantially.'. - "\n\n". - 'You can compute a specific connection limit for your install by '. - 'doing a lot of math with MySQL buffer sizes and RAM available on '. - 'the machine, or just set it to a huge number. In nearly every case, '. - 'setting it to a huge number is entirely reasonable.'. - "\n\n". - 'You can raise this limit by adding this to your %s file (in the %s '. - 'section) and then restarting %s:'. - "\n\n%s", - 'max_connections', - $max_connections, - phutil_tag('tt', array(), 'my.cnf'), - phutil_tag('tt', array(), '[mysqld]'), - phutil_tag('tt', array(), 'mysqld'), - phutil_tag('pre', array(), 'max_connections=100000')); - - $this->newIssue('mysql.max_connections') - ->setName(pht('Small MySQL "%s"', 'max_connections')) - ->setMessage($message) - ->addMySQLConfig('max_connections'); - } - $modes = self::loadRawConfigValue('sql_mode'); $modes = explode(',', $modes); diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php index feae254095..d3a287259a 100644 --- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php +++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php @@ -79,9 +79,15 @@ abstract class PhabricatorLiskDAO extends LiskDAO { // - (T10849) Prevent any query from running for more than 30 seconds. // - (T11672) Use persistent connections. if (php_sapi_name() != 'cli') { + + // TODO: For now, disable this until after T11044: it's better at high + // load, but causes us to use slightly more connections at low load and + // is pushing users over limits like MySQL "max_connections". + $use_persistent = false; + $connection ->setQueryTimeout(30) - ->setPersistent(true); + ->setPersistent($use_persistent); } return $connection;