CLOVER🍀

That was when it all began.

systemd制埡䞋で動䜜するプロセスの、リ゜ヌス制埡を行う

これは、なにをしたくお曞いたもの

Linuxにおけるリ゜ヌス制埡ずいえば、ulimitです。

limits.conf(5) - Linux manual page

/etc/security/limits.confファむルや/etc/security/limits.dディレクトリ内に[任意の名前].confファむルを䜜成しお
nofileなどの倀を蚭定すればOKです。

ですが、systemd制埡䞋で動䜜するプロセスはこの事情が違いたす。前々からなんずなく知っおはいたしたが、
自分で蚭定したこずがなかったので詊しおおくこずにしたした。

環境

今回の環境は、こちら。Ubuntu Linux 20.04 LTSです。

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal


$ uname -srvmpio
Linux 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

たた、リ゜ヌス制埡を行う察象のサヌビスずしお、nginxを䜿うこずにしたす。

$ sudo apt install nginx

バヌゞョン。

$ nginx -v
nginx version: nginx/1.18.0 (Ubuntu)

むンストヌルした時点で、nginxはrootナヌザヌで起動しおいたす。

$ ps -ef | grep nginx | grep -v grep
root        3976       1  0 14:32 ?        00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data    3977    3976  0 14:32 ?        00:00:00 nginx: worker process
www-data    3978    3976  0 14:32 ?        00:00:00 nginx: worker process

この時の/proc/[PID]/limitsを芋るず、Max open filesのsoft limitが1024になっおいるので、こちらを倉曎しおみたしょう。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            1024                 524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

/etc/security/limits〜が効かないこずを確認する

たずは/etc/security/limits〜が効かないこずを確認しおみたす。

rootナヌザヌにスむッチしお、珟圚の倀を確認。

$ sudo su -

# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 7596
max locked memory       (kbytes, -l) 65536
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 7596
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

ファむルの曞き方は、/etc/security/limits.confファむルに曞かれおいるので

/etc/security/limits.conf

# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - a user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#        - NOTE: group and wildcard limits are not applied to root.
#          To apply a limit to the root user, <domain> must be
#          the literal username root.
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open file descriptors
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#        - chroot - change root to directory (Debian-specific)
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#root            hard    core            100000
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#ftp             -       chroot          /ftp
#@student        -       maxlogins       4

# End of file

こんなファむルを䜜成。

/etc/security/limits.d/root.limits.conf

root            -    nofile            10240

1床シェルを抜けお、再床rootにスむッチしお確認。

$ sudo su -


# ulimit -n
10240


# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 7596
max locked memory       (kbytes, -l) 65536
max memory size         (kbytes, -m) unlimited
open files                      (-n) 10240
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 7596
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

open filesの倀が増えおいるこずが確認できたす。

このあたりは、PAMの範囲です。

$ grep -r limit /etc/pam.d
/etc/pam.d/runuser:session              required        pam_limits.so
/etc/pam.d/systemd-user:session  required pam_limits.so
/etc/pam.d/sshd:# access limits that are hard to express in sshd_config.
/etc/pam.d/sshd:# Set up user limits from /etc/security/limits.conf.
/etc/pam.d/sshd:session    required     pam_limits.so
/etc/pam.d/atd:session    required   pam_limits.so
/etc/pam.d/login:# set access limits.
/etc/pam.d/login:# Sets up user limits according to /etc/security/limits.conf
/etc/pam.d/login:# (Replaces the use of /etc/limits in old login)
/etc/pam.d/login:session    required   pam_limits.so
/etc/pam.d/su:# Sets up user limits according to /etc/security/limits.conf
/etc/pam.d/su:# (Replaces the use of /etc/limits in old login)
/etc/pam.d/su:session    required   pam_limits.so
/etc/pam.d/cron:# Sets up user limits, please define limits for cron tasks
/etc/pam.d/cron:# through /etc/security/limits.conf
/etc/pam.d/cron:session    required   pam_limits.so

なのですが、nginxを再起動しおも

$ sudo systemctl restart nginx

こちらのMax open filesの倀は倉わりたせん。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            1024                 524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

こちらは事情が異なりたす、ず。

今回は、これを倉曎できるようにするこずが目的です。

systemdのドキュメントを読む

systemdのナニットのリ゜ヌス制埡は、ナニット定矩ファむルで行いたす。

こちらを芋るず、プロセスのリ゜ヌス制埡に぀いお曞かれおいたす。

PROCESS PROPERTIES

   LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=,
   LimitRSS=, LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=,
   LimitLOCKS=, LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=,
   LimitRTPRIO=, LimitRTTIME=

[https://man7.org/linux/man-pages/man5/systemd.exec.5.html:title]

各項目が、ulimitのどの項目に該圓するかも曞かれおいたすね。

Table 1. Resource limit directives, their equivalent ulimit shell commands and the unit used

LimitNOFILE ulimit -n

プロセスのリ゜ヌス制埡も含め、こういったカテゎリのものが蚭定できるようなので、ドキュメントには
目を通しおおくずよいでしょう。

  • PATHS
  • USER/GROUP IDENTITY
  • CAPABILITIES
  • SECURITY
  • MANDATORY ACCESS CONTROL
  • PROCESS PROPERTIES
  • SCHEDULING
  • SANDBOXING
  • 


今回の察象のnginxのサヌビスナニット定矩ファむルはこちらなので

/etc/systemd/system/multi-user.target.wants/nginx.service

# Stop dance for nginx
# =======================
#
# ExecStop sends SIGSTOP (graceful stop) to the nginx process.
# If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control
# and sends SIGTERM (fast shutdown) to the main process.
# After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends
# SIGKILL to all the remaining processes in the process group (KillMode=mixed).
#
# nginx signals reference doc:
# http://nginx.org/en/docs/control.html
#
[Unit]
Description=A high performance web server and a reverse proxy server
Documentation=man:nginx(8)
After=network.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed

[Install]
WantedBy=multi-user.target

ServiceにLimitNOFILEを蚭定。

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed
LimitNOFILE=10240

蚭定をリロヌドしお、nginxを再起動。

$ sudo systemctl daemon-reload
$ sudo systemctl restart nginx

倉曎が反映されたしたね。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            10240                10240                files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

hard limitも䞀緒の倀になっおしたいたしたが。

これが気持ち悪い堎合は、以䞋のようにするずsoft limitずhard limitをそれぞれ指定できたす。

LimitNOFILE=10240:524288

再読み蟌みしお、再起動埌しお確認。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            10240                524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

soft limitずhard limitをそれぞれ指定できたした。

これは、ドキュメントにそのように曞いおありたす。

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

ここで、1床ナニット定矩ファむルを元に戻したす。

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed

このように、パッケヌゞでむンストヌルされたナニット定矩ファむルを觊るのは嫌だず思うかもしれたせん。

そこで、「drop-in」ずいう仕組みを䜿いたす。以䞋のように/etc/systemd/system/[サヌビス名].dずいうディレクトリを
䜜成したす。

$ sudo mkdir /etc/systemd/system/nginx.service.d

この䞭に眮いたファむルは、「drop-in」ずいう仕組みでナニット構成ファむルをオヌバヌラむドできるようです。
※なのですが、drop-inに぀いお調べるずだいたい先ほどmkdirで䜜成したディレクトリの情報が珟れるのですが、これは
 どこの情報なんでしょうね

In addition to the "main" configuration file, drop-in configuration snippets are read from /usr/lib/systemd/.conf.d/, /usr/local/lib/systemd/.conf.d/, and /etc/systemd/.conf.d/. Those drop-ins have higher precedence and override the main configuration file. Files in the .conf.d/ configuration subdirectories are sorted by their filename in lexicographic order, regardless of in which of the subdirectories they reside. When multiple files specify the same option, for options which accept just a single value, the entry in the file sorted last takes precedence, and for options which accept a list of values, entries are collected as they occur in the sorted files.

When packages need to customize the configuration, they can install drop-ins under /usr/. Files in /etc/ are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages. Drop-ins have to be used to override package drop-ins, since the main configuration file has lower precedence. It is recommended to prefix all filenames in those subdirectories with a two-digit number and a dash, to simplify the ordering of the files.

systemd-system.conf(5) - Linux manual page

ファむル名には2桁の数字を付けるこずが掚奚されおいるようなので

It is recommended to prefix all filenames in those subdirectories with a two-digit number and a dash, to simplify the ordering of the files.

こんな感じに䜜成しお

/etc/systemd/system/nginx.service.d/00-limits.conf

[Service]
LimitNOFILE=10240:524288

再読み蟌みさせるず

$ sudo systemctl daemon-reload
$ sudo systemctl restart nginx

反映されたした。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            10240                524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

systemctl statusを芋るず、「Drop-In」ずいう衚瀺が珟れるようになっおいたす。

$ sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/nginx.service.d
             └─00-limits.conf
     Active: active (running) since Thu 2021-12-02 15:32:01 JST; 42s ago
       Docs: man:nginx(8)
    Process: 6734 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 6735 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 6736 (nginx)
      Tasks: 3 (limit: 2278)
     Memory: 3.5M
     CGroup: /system.slice/nginx.service
             ├─6736 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─6737 nginx: worker process
             └─6738 nginx: worker process

12月 02 15:32:01 ubuntu2004.localdomain systemd[1]: Starting A high performance web server and a reverse proxy server...
12月 02 15:32:01 ubuntu2004.localdomain systemd[1]: Started A high performance web server and a reverse proxy server.

党䜓のデフォルト倀を倉曎する

最埌に、systemdで管理しおいるナニット党䜓のデフォルト倀を倉曎しおみたしょう。あたり䜿う機䌚はない気はしたすが。

先ほどのnginxのdrop-inのファむルはコメントアりトしお

/etc/systemd/system/nginx.service.d/00-limits.conf

#[Service]
#LimitNOFILE=10240:524288

nginxにも反映しおおきたすデフォルトに戻しおおきたす。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            1024                 524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

これは、以䞋で指定したす。

DefaultLimitCPU=, DefaultLimitFSIZE=, DefaultLimitDATA=, DefaultLimitSTACK=, DefaultLimitCORE=, DefaultLimitRSS=, DefaultLimitNOFILE=, DefaultLimitAS=, DefaultLimitNPROC=, DefaultLimitMEMLOCK=, DefaultLimitLOCKS=, DefaultLimitSIGPENDING=, DefaultLimitMSGQUEUE=, DefaultLimitNICE=, DefaultLimitRTPRIO=, DefaultLimitRTTIME=

ファむルの堎所は、このあたりのようですね。

/etc/systemd/system.conf, /etc/systemd/system.conf.d/.conf, /run/systemd/system.conf.d/.conf, /usr/lib/systemd/system.conf.d/*.conf

~/.config/systemd/user.conf, /etc/systemd/user.conf, /etc/systemd/user.conf.d/.conf, /run/systemd/user.conf.d/.conf, /usr/lib/systemd/user.conf.d/*.conf

systemd-system.conf(5) - Linux manual page

実際、/etc/systemd/system.confファむルを芋るず、コメントアりトされおいたすが蚭定項目があるのがわかりたす。

$ grep DefaultLimit /etc/systemd/system.conf

#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=1024:524288
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=

ちなみに、これはManagerずいう蚭定カテゎリになりたす。

[Manager]

これらの項目は、systemdで管理されおいるサヌビスすべおに圱響するので、あたり䜿うこずはないかなず思いたすが。
詊すだけ詊しおおきたしょう。

ここで、以䞋のように蚭定しお

[Manager]
DefaultLimitNOFILE=10240:524288

反映。

$ sudo systemctl daemon-reload
$ sudo systemctl restart nginx

確認。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            10240                524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

今回はnginxだけ再起動しお確認しおみたしたが、デフォルト倀蚭定埌に起動したプロセスには圱響するように
なりたす。

たた、このファむルも別に切り出すこずができたす。

ルヌルがこうなので

/etc/systemd/system.conf, /etc/systemd/system.conf.d/.conf, /run/systemd/system.conf.d/.conf, /usr/lib/systemd/system.conf.d/*.conf

~/.config/systemd/user.conf, /etc/systemd/user.conf, /etc/systemd/user.conf.d/.conf, /run/systemd/user.conf.d/.conf, /usr/lib/systemd/user.conf.d/*.conf

ディレクトリを䜜成しお

$ sudo mkdir /etc/systemd/system.conf.d

ファむルを䜜成。

/etc/systemd/system.conf.d/00-override.conf

[Manager]
DefaultLimitNOFILE=10240:524288

再読蟌しお、反映。

$ sudo systemctl daemon-reload
$ sudo systemctl restart nginx

倉曎が確認できたした。

$ cat /proc/$(cat /run/nginx.pid)/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             7596                 7596                 processes 
Max open files            10240                524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       7596                 7596                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us

たずめ

systemd制埡䞋で動䜜するプロセスの、リ゜ヌス制埡を行っおみたした。

drop-inファむルの堎所ずドキュメントの曞かれ方にちょっず癖がある気がしたすがUbunut Linuxだからですかね 、
ここだけちょっずハマりたした。

だいたいやり方はわかったので良しずしたしょう。