私のsystemdサービスにいくつかの制限を設定したいと思います。たとえば、次のようになります。
- ネットワーク帯域幅
- CPU見積もり
制限を超えると、systemdサービスを停止する必要があります。
事前にありがとう
ベストアンサー1
バラよりman systemd.exec
:
PROCESS PROPERTIES
LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=, LimitNOFILE=, LimitAS=,
LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=, LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=,
LimitRTPRIO=, LimitRTTIME=
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for
details on the resource limit concept. Resource limits may be specified in two formats:
either as single value to set a specific soft and hard limit to the same value, or as
colon-separated pair soft:hard to set both limits individually (e.g. "LimitAS=4G:16G").
Use the string infinity to configure no limit on a specific resource. The multiplicative
suffixes K, M, G, T, P and E (to the base 1024) may be used for resource limits measured in
bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the usual time units
ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no time
unit is specified for LimitCPU= the default unit of seconds is implied, while for
LimitRTTIME= the default unit of microseconds is implied. Also, note that the effective
granularity of the limits might influence their enforcement. For example, time limits
specified for LimitCPU= will be rounded up implicitly to multiples of 1s. For LimitNICE=
the value may be specified in two syntaxes: if prefixed with "+" or "-", the value is
understood as regular Linux nice value in the range -20..19. If not prefixed like this the
value is understood as raw resource limit parameter in the range 0..40 (with 0 being
equivalent to 1).
帯域幅の場合、以下で複数のオプションを定義できます。man systemd.resource-control
。.service
、、、、、、または単位は、次.socket
のいずれかを使用できます。.slice
.scope
.swap
.mount
IOWeight=weight, StartupIOWeight=weight
Set the default overall block I/O weight for the executed processes, if the
unified control group hierarchy is used on the system. ...
kernel.orgによるとIOインタフェースファイル
重みの範囲は[1、10000]で、cgroupが兄弟グループと比較して使用できる相対的なIO時間を指定します。
IOReadBandwidthMax=device bytes, IOWriteBandwidthMax=device bytes
Set the per-device overall block I/O bandwidth maximum limit for the executed
processes, if the unified control group hierarchy is used on the system. This
limit is not work-conserving and the executed processes are not allowed to use
more even if the device has idle capacity. ...
IOReadIOPSMax=device IOPS, IOWriteIOPSMax=device IOPS
Set the per-device overall block I/O IOs-Per-Second maximum limit for the
executed processes, if the unified control group hierarchy is used on the
system. This limit is not work-conserving and the executed processes are not
allowed to use more even if the device has idle capacity. ...