Implement memory reserves in autoscale pools
Summary:
Ref T7352. If an autoscale pool specifies a memory reserve, don't scale the pool up unless the machine has at least that proportion of its RAM free.
This is off by default because it doesn't impact most users and we may not be able to get memory information on some systems (e.g., FreeBSD).
Test Plan:
Changed "HighIntensity" daemon to:
- Always remain busy.
- Use 512MB of RAM for no reason.
Changed phd debug --autoscale to:
- Specify a reserve of 0.15.
- Specify a pool size of 1024.
Then, observed:
- Pool expanded up to 6 daemons, bringing reserve down from 30% of system RAM to 13%.
- Pool stopped expanding at this point and remained at a fixed size.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley
Maniphest Tasks: T7352
Differential Revision: https://secure.phabricator.com/D11864