LE-SSL on Hestia Control Panel

25% of ram with a max of 2 gb should be more then enough.

1 Like

Agree with both Felix and Eris comments, plus vm.swappiness equal to 0 or 1.
My settings: on a typical VPS 1GB swap and on a hypervisor 2GB swap - not a hard rule though.

1 Like

It is always good idea to have swap space in low RAM setup. In recent years low RAM setups are those less than 8GB.
Yes, you can argue that 4GB is quite enough from HestiaCP and few websites you are hosting but there is no logical reason not to include few GBs for swap space. It will give you peace of mind and time to react in case your VPS start using swap extensively.
As to your second question, it is a safe rule to allocate twice as much swap as you have RAM. In your case it would be 8GB. You can, however, start with 2GB of swap space and increase it later on.
Also you can create/find a script to email you when swap usage exceeds certain value.

1 Like

This is very much outdated. 2x RAM was from when I ran *nix boxes with HDD and 128MB RAM! Extensive swap > 2GB is counter productive and will kill performance. With SSD/NVMe it is important to minimise swap access.

Extreme example; this laptop has 6GB RAM and 128MB swap on zero swappiness. It is there only to assist with memory management.

1 Like

Regarding Swap setup, this article from Digital Ocean is a must read article: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04

Thatā€™s not bad, though with some heresay and generalisation. :wink:
A partition is preferred over a swapfile - better to have a native swapfs, rather than on top of ext2/ext4/xfs. Can be added as a LVM logical volume.
The swappiness explanation is vague (fair enough) and doesnā€™t mention a setting for minimal use. This is not surprising as DO discourage swap with SSD.

The vfs_cache_pressure section is useful, as thatā€™s often a missed out aspect, though rarely tweaked.

As it is currently configured, our system removes inode information from the cache too quickly.

No mention on how that was analysed. :-/ slabtop?

Note: Windoze lusers have been advised for decades to tweak their swap file to a fixed size and is much more beneficial on that OS, for a number of reasons.

1 Like

It will kill performance?! Really?! Can you please show us example where that statement is true?
Swap is just reserved disk space to be used in case you run out of ram. If your server is using swap extensively you will notice the slowdown but its not because you have large swap partition.
In recent years we have a situation that our setups have more than enough ram and we were introduced to afordable SSDā€™s. SSDā€™s are fast but loose endurance if you write/delete alot, something swap is doing all the time.
You might be ok not having swap on your computer but not having any on production server is risky at best. Reason for that is its easier to deal with a client complaining about slow load than a client complaining about downtime.
My recommendation for his setup was to use swap with 2GB and work from there.
Your recommendation was ā€¦ oh yeah ā€¦ none. Instead you did plug that you ran ā€œ*nix boxesā€. From your attitude I can conclude that UNIX systems become obsolete at the time you were born. ā€œWindoze lusersā€ ā€¦ dude please.

I think the whole discussion about swap is overrated. I totally agree on the stance, that some swap should always be available, as you for sure donā€™t want to have processes killed because you are out of memory. that said if your system uses swap a lot you usually have not enough memory and therefore should simply invest into more ram, itā€™s not the swap thatā€™s hurting performance then :wink:

I also disagree with the size of swap being related to the performance at all and also with the impact of the swappiness setting. Iā€™d rather say this is a tunable that might help a bit if you are in a tight situation already, but generally speaking the system can manage itā€™s memory quite good so setting this to extreme low values wonā€™t change a thing, esp. if you have enough RAM already anyway :wink:

as it has been said before swap is there ā€œjust in caseā€ and to ā€œhave breathing roomā€ and this should be perfectly fine, then there is no need to fiddle with swappiness. rest asured the system will only swap dirty unneeded pages anyways.

also about ssd/nvmeā€¦ because of itā€™s speeds Iā€™d rather say having swap on there is even more a nobrainer than with hdd. so from my opinion nothing that needs to be avoided :wink:

however, just my 2 cents anyway.

3 Likes

Hardly worth the effort to further comment, TBH.
Apart from saying I cut my teeth on Windoze 3.1/DOS 3, before Unix SVR4.2/AIX/HP-UX/Solaris/Slackware/Mandrake etc. and still having to support crap Win 95/98/Me/NT and subsequent bloatware OS.

(Kill performance was a bit extreme, to get the point over - though can shorten the life of SSD/NVMe. :wink: )

Wrong, blatantly wrong and the reverse.

haha, thatā€™s very true. yet there are providers in the lowendmarket who use swap on nvme to overcommit on RAM :man_shrugging:

but I think in the end we all agree anyway, that ideally swap is not used at all because youā€™ll have enough RAM for your use case, though at least some swap is there as a fallback anyway.

2 Likes