4

When a server is overloaded, what is a way under systemd to give ssh a high priority to ensure a remote ssh connection gets a priority to resolve the critical situation?

danblack
  • 1,249
  • 13
  • 15
  • 1
    What kind of load are you talking about? CPU will likely not be the problem, even if SSH only gets a fraction of CPU time. More likely a problem is load caused by iowait and/or swapping. Solving this requires more than just setting a priority. – Halfgaar Nov 02 '18 at 12:42
  • So [IOSchedulingPriority=](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#IOSchedulingPriority=)1? – danblack Nov 02 '18 at 13:09
  • It's not quite that simple, especially if the machine is virtualized. Simulate some IO with benchmark tools and see what happens. – Halfgaar Nov 02 '18 at 22:00

1 Answers1

9

Create a systemd override file setting the nice level to a high negative priority (maximum is -20, however some kernel processes require that for integrity).

/etc/systemd/system/ssh.service.d/nice_high.conf 

[Service]
Nice=-15

Run systemctl daemon-reload for this to have an effect.

danblack
  • 1,249
  • 13
  • 15