What is the recommended way to handle OOM Killer?

I’m running two relays on Ubuntu 22.04, and I’m having issues with the OOM (Out Of Memory) Killer event is getting triggered and restarting the service.

Each of the servers has 8 GB memory and the memory is never maxed out, they typically have 25% free memory.

I tried searching Google and couldn’t find a clear answer, except that disabling OOM Killer isn’t a good idea.

What is the best way to prevent OOM Killer from restarting the Tor service?

If the OOM killer starts working, in all likelihood it’s too late for this boot cycle. It will usually take more work to figure out what needs to be restarted than it will take to just reboot the whole damn thing. If the relays are the only major / “production” services running on the server, MaxMemInQueues should preclude tor from consuming unbounded memory and resulting in system OOM. It may already be set to something sane (typically around 3/4 of available system mem) but you can lower it if needed.