today I setup a new Debian-Server and I realizied that it has a SWAP partition by default:
Is it safe to remove the Swap-Partition? Probaly I have to reinstall Debian and choose the right options for it. Got plenty of RAM, like more than 3 GB per Node. Would the system crash when the RAM is full or what would be your advice.
When you run out of ram, the out-of-memory killer will start killing processes based on each processes “oom score”. You can disable swap if you are fairly certain you’ll never run OOM.
However, what you might want to look into first is changing the “vm.swappiness” sysctl value to 0, which will minimize unnecessary swapping. You’ll still have swap if needed in an emergency, but it should cut down on swapping when you aren’t actually out of memory.
This is very little. But not because node consumes a lot of ram. Node uses very little. But it creates a lot of files. You want free ram to fit metadata of all of them in cache. That cache resides in unused ram. If you don’t have unused ram — there is no cache, and all requests hit the HDD.
That’s how you reduce IO to disks, not by messing with swap. By the time swapping becomes a problem it’s already too late. It’s a wrong problem to be solving.
In a system running server processes it can happen that user interface processes get swapped out so that the server processes can run better or files can be cached better.
If that is affecting you, you can use swapoff
Messing with vm.swappiness is more an internet meme than anything useful but you might increase it if you had really fast swap and slow os drive