DouglasNeuroInformatics / ansible-playbooks

Playbooks for configuring CIC Workstations and Servers
4 stars 11 forks source link

Configure more swap #60

Closed gdevenyi closed 7 months ago

gdevenyi commented 1 year ago

Default ubuntu install has tiny swap. Considering we're doing computation, swap = RAM (max 128G?) is probably worth setting up on all systems.

gdevenyi commented 11 months ago

Pseudocode:

(swapfile is already in fstab on all machines)

thomasbeaudry commented 11 months ago

I guess i never submitted my PR for this. What i did was check to see if there the machine has at least 200Gb of free disk space and if it did, create a 128GB swapfile. You want that instead?

gdevenyi commented 11 months ago

What i did was check to see if there the machine has at least 200Gb of free dis

I think the check for free space is an obvious great idea :+1:. however, I don't think I want oodles of swap on a 8GB machine (which do exist). That will cause some ugly performance for systems that really shouldn't be used for processing at all.

thomasbeaudry commented 11 months ago

I'm not sure if I understand the logic behind your psudeo code:

If the system has 128Gb or less of physical RAM then it will set the /swapfile size to 128GB. If the system has more than 128GB of RAM, then it will make the swap size match that amount.

From what I read, what I think makes sense is that if the system has 8GB or less, the max swap we give is 2X the RAM. If the system has more than 8GB we can set it to 128GB, and if has more than 128GB of RAM, we set the swap to that value. Sounds good?

gdevenyi commented 11 months ago

The snip comes from this jinja2 code here modified.

https://github.com/nickjj/ansible-swapfile

gdevenyi commented 11 months ago

Before we decide on such large swap, we should check there's enough free space everywhere

thomasbeaudry commented 11 months ago

Well yes, in the context of that snippet it makes sense because it's looking at <= 2GB and if it a system has more than 2GB, it makes swap the same size as the RAM.

In our case, that logic doesn't apply. Here is the current breakdown of responsive machines (host,free space, RAM)

cicws01,164G,23Gi cicws02,163G,23Gi
cicws03,1.7T,15Gi cicws04,51G,23Gi cicws06,162G,23Gi cicws08,162G,23Gi cicws09,51G,35Gi cicws11,21G,23Gi cicws12,58G,23Gi cicws13,54G,23Gi cicws15,53G,23Gi cicws16,165G,23Gi cicws18,53G,23Gi cicws19,56G,23Gi cicws24,153G,31Gi cicws25,821G,31Gi cicws26,820G,31Gi cicws27,820G,31Gi cicws28,821G,31Gi cicws29,820G,31Gi cicws30,820G,31Gi cicws31,169G,31Gi cicws35,166G,31Gi cicws38,160G,31Gi cicws41,387G,31Gi cicws42,380G,31Gi cicws43,373G,31Gi cicws44,379G,31Gi cicws46,380G,31Gi cicws47,821G,125Gi cicws48,820G,125Gi dnpws01,389G,7.4Gi dnpws02,388G,7.4Gi dnpws03,387G,7.4Gi dnpws04,389G,7.4Gi dnpws05,386G,31Gi dnpws06,386G,31Gi dnpws07,375G,31Gi dnpws08,178G,125Gi dnpws09,388G,62Gi dnpws10,386G,62Gi dnpws11,382G,62Gi dnpws12,382G,62Gi dnpws13,690G,62Gi dnpws15,1.6T,62Gi dnpws16,1.7T,62Gi cichm01,161G,117Gi

I would say for a good portion of these, 128G is too big for the remaining amount of diskspace. I think what makes sense is to make the swapsize 2 or 3 times the RAM providing there is at least twice the amount of free space as this new swapsize value. In the cases where there isn't enough free space, we either leave the swapsize at 2G or we make it equal to the same size of the RAM (providing there is at least twice as much free space as this value).

gdevenyi commented 11 months ago

I'm fine with whatever you choose here, its clear swap should be larger than it is RAM++ is reasonable.