Page MenuHomePhabricator

Add a setup issue about small "max_connections" settings
ClosedPublic

Authored by epriestley on Sep 22 2016, 7:39 PM.

Details

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

Screen Shot 2016-09-22 at 12.32.10 PM.png (1×1 px, 253 KB)

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Add a setup issue about small "max_connections" settings.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
src/applications/config/check/PhabricatorMySQLSetupCheck.php
66

is this number right?

Yeah, my reasoning is:

  • I know of no reason to have this limit at all.
  • We can't disable it: the minimum value is 1 and the maximum value is 100000.
  • Picking 32768 (half of the number of outbound TCP ports, 65536) is largely arbitrary, but means that the host won't exhaust outbound ports if it's connecting to itself over TCP for some reason (unusual, but not unheard of), probably.
src/applications/config/check/PhabricatorMySQLSetupCheck.php
50

Oh I forgot some words here, one sec.

chad edited edge metadata.
This revision is now accepted and ready to land.Sep 22 2016, 7:48 PM

There seems to be a very weak argument for setting this to "memory on your host - innodb buffer size - some other buffers / approximate memory usage of a connection" so that MySQL will start rejecting connections rather than swapping to death if you exhaust all the memory on the host.

I still think "a million billion" is the right value for 99% of installs, but I'll be slightly more nuanced in discussing how to select a value.

epriestley edited edge metadata.
  • Fill in missing words.
  • Offer users the chance to do a lot of math if they're really committed.
This revision was automatically updated to reflect the committed changes.