Vagrantfile: Set upper bound of 3GB RAM
Systems have more and more RAM these days, and using 1/4 of the system RAM seems quite overkill in many cases. With this change, a user can tweak either the desired fraction of RAM, the lower bound, or the upper bound, each by adjusting a single number.
This commit is contained in:
1 parent
19c2745f38
commit
6f386d84db
1 file changed
+7
-4
Vendored
+7
-4
@@ -67,8 +67,9 @@ EOF
|
||||
# Use the same number of CPUs within Vagrant as the system, with 1
|
||||
# as a default.
|
||||
#
|
||||
# Use at least 512MB of RAM, and if the system has more than 2GB of
|
||||
# RAM, use 1/4 of the system RAM. This seems a reasonable compromise
|
||||
# If we are unable to determine how much RAM the system has, use
|
||||
# 1GB. Otherwise, we aim to use 1/4 of the system RAM, with a
|
||||
# lower bound of 512MB and upper bound of 3GB. This is a compromise
|
||||
# between having the Vagrant guest operating system not run out of
|
||||
# RAM entirely (which it basically would if we went much lower than
|
||||
# 512MB) and also allowing it to use up a healthily large amount of
|
||||
@@ -80,10 +81,12 @@ EOF
|
||||
else
|
||||
assign_cpus = cpus
|
||||
end
|
||||
if total_kB_ram.nil? or total_kB_ram < 2048000
|
||||
assign_ram_mb = 512
|
||||
if total_kB_ram.nil?
|
||||
assign_ram_mb = 1024
|
||||
else
|
||||
assign_ram_mb = (total_kB_ram / 1024 / 4)
|
||||
assign_ram_mb = [ 512, assign_ram_mb].max # enforce lower bound
|
||||
assign_ram_mb = [3072, assign_ram_mb].min # enforce upper bound
|
||||
end
|
||||
|
||||
# Actually provide the computed CPUs/memory to the backing provider.
|
||||
|
||||
Reference in new issue
Block a user