1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

Add a setup issue about small "max_connections" settings

Summary:
Fixes T11683. Likely as a result of the persitent connections change, more users are seeing MySQL connection limit errors.

The persistent connections change means we use //fewer// connections at the high end, but I'm guessing PHP is keeping some more connections around in the pool, so while high-traffic hosts use fewer connections, low-traffic hosts now use more.

Raise an explicit setup warning about this. Users should be adjusting it anyway, there's no value to leaving it at extremely low default and connections are baiscally free until you run out of outbound ports.

Test Plan: {F1844630}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11683

Differential Revision: https://secure.phabricator.com/D16586
This commit is contained in:
epriestley 2016-09-22 12:32:16 -07:00
parent 66c7f22c27
commit 396be07c15

View file

@ -44,6 +44,40 @@ 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);