Is it recommended to set OOMScoreAdjust=1000 in systemd for a replaceable service?
Solution 1:
In the case of a server with a single process it will probably not make a huge difference, but this can really shine if you have a process that frequently leaks memory.
For example on the desktop, Firefox tends to use more and more memory until the OOM-killer is invoked, and invariably it will decide that Xorg is using the most memory and kill it, bringing down your whole desktop when really it was only the browser that needed to be restarted.
So in this case setting the leaky program to have an OOM score of 1000 and to restart immediately won't be a problem, because it will get killed first and when it reloads it won't be using as much memory as before, freeing up memory overall.
If the process has a fairly constant memory use then it's unlikely to matter (but certainly won't hurt), but if it's leaky then it would likely result in quicker recovery than having the AWS ELB notice the problem and build a new VM.