Page MenuHomeVyOS Platform

Add proper priorities for systemd daemons
Open, NormalPublicFEATURE REQUEST

Description

We need to think about setting proper priorities and some limits on resource usage (if necessary) per daemons which are started with systemd.
There are issues when some of the daemons, for example, snmpd can get 100% CPU utilization a lot of time.
This behavior can often lead to the fact that resources for other more important daemons/services (like frr/routing/etc) may simply not be enough.
This can cause daemons/processes to crash.

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

syncer triaged this task as Normal priority.
syncer removed a subscriber: Global Notifications.

A simple check works fine:
Set 20% quota for snmpd
And check it with script:

#!/usr/bin/env bash

while true
  do
    snmpwalk -v 2c -c public 127.0.0.1
  done

Edit service:

sudo systemctl edit snmpd

Replace:

[Service]
Environment=
Environment="MIBDIRS=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/vyos/mibs"
ExecStart=
ExecStart=/usr/sbin/snmpd -LS0-5d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -ipCidrRouteTable,inetCidrRouteTable -f -p /run/snmpd.pid
Restart=always
RestartSec=10

To:

[Service]
Environment=
Environment="MIBDIRS=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/vyos/mibs"
ExecStart=
ExecStart=/usr/sbin/snmpd -LS0-5d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -ipCidrRouteTable,inetCidrRouteTable -f -p /run/snmpd.pid
Restart=always
RestartSec=10
CPUQuota=20%

CPU before

before.png (290×1 px, 71 KB)

and after
after.png (270×986 px, 65 KB)

Needs to think about all necessary services and their limits

dmbaturin set Issue type to Unspecified (please specify).
dmbaturin renamed this task from Add properly priorities for systemd daemons to Add proper priorities for systemd daemons.Oct 14 2024, 9:31 AM
dmbaturin edited projects, added VyOS Rolling, VyOS 1.4 Sagitta (1.4.0); removed Restricted Project.
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin changed Issue type from Unspecified (please specify) to Bug (incorrect behavior).

It is not implemented
But it probably will not be implemented
The only affected service was SNMP