Hi,
Is there any native way to set ulimit for a coreos build?
I’m investigating using it to run a docker application that requires a signicant amount of open files.
I know i can set the file limit in the container via --ulimit nofile=262144:262144 but my coreos image shows a file limit
open files (-n) 1024
Thanks
Vladislav Grigoryev:
systemd-system.conf
Thanks Vladislav, is that applicable to coreos? that file (or any of the standard directories) doesn’t exist on the test instances that I have
I tried setting
cat /etc/systemd/system.conf
[manager]
DefaultLimitNOFILE=65536
but ulimit -a still shows 1024 so i assume that coreos pulls that value from elsewhere
1 Like
I’ve just tried configuring Butane to create a systemoverrides bash file
storage:
files:
- path: /etc/propertyoverride.sh
mode: 0744
contents:
inline: |
#!/bin/bash
echo '* soft nofile 4096' >> /etc/security/limits.conf
echo '* hard nofile 8192' >> /etc/security/limits.conf
echo 'root soft nofile 4096' >> /etc/security/limits.conf
echo 'root hard nofile 8192' >> /etc/security/limits.conf
And then a oneshot systemd unit file
systemd:
units:
- name: set-systemoverrides.service
enabled: true
contents: |
[Unit]
Description=Setup system parameter overrides
[Service]
Type=oneshot
ExecStart=bash /etc/propertyoverride.sh
[Install]
WantedBy=multi-user.target
It feels a bit hacky but seems to work ok
That is the soft limit.
But you have set the hard limit with DefaultLimitNOFILE=65536
I think.
You can see the hard limit with ulimit -aH
.
Usually an app with set the soft limit higher when it runs.
One can see the options for ulimit by using man ulimit
which brings up the man page for the bash built-ins, then search for ulimit.
ulimit -a
displays all limits that are set; and as already mention ulinit -aH
gives the hard limits.
for my user I see
open files (-n) 1024
and
open files (-n) 1048576
respectively.
dustymabe
(Dusty Mabe)
May 31, 2023, 1:00am
9
I think this can be improved. Ignition/Butane do support appending to a file:
storage:
files:
- path: /etc/security/limits.conf
mode: 0644
append:
- inline: |
* soft nofile 4096
* hard nofile 8192
root soft nofile 4096
root hard nofile 8192
1 Like
ninjasftw
(ninjasftw)
May 31, 2023, 9:09am
10
That worked great thanks!
1 Like