Page MenuHomeVyOS Platform

Add properly 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

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

syncer triaged this task as Normal priority.
syncer removed a subscriber: Active contributors.

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).