Re: ulimit or files-max?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 13, 2023, at 16:50, Alex <mysqlstudent@xxxxxxxxx> wrote:


Hi, what is the current way to increase the number of available open files? This is for a mariadb database server I'm trying to configure based on instructions from the database developer to increase the total number of files to 50000. I've added the following to /etc/security/limits.conf and rebooted:

root            -       nofile          50000

ulimit -n as root now shows:
# ulimit -n
50000

Can this value also be set by using sysctl and setting fs.file-max to 50000?
# sysctl -a|grep file
fs.file-max = 50000
fs.file-nr = 6864       0       50000
fs.xfs.filestream_centisecs = 3000

Which is the correct way? Also, does fs.file-nr mean there are currently 6864 open files on the system?

The file /etc/security/limits.conf is only used for a process that passes through the PAM stack, such as users logging in or a process launched through the old init process that effectively used “su”. 

In systemd, the MariaDB process is launched directly as the user defined in the unit file, so it isn’t affected by the pam_limits module. 

You want to set the LimitNOFILE control in the Service section of the systemd unit. Here’s documentation for the setting:


You’d add this by running `systemctl edit mariadb.service` and create a `[Service]` section with the limit defined. 
(I’m guessing at the unit name, please use the right name where appropriate)

I’ll note that the man page above says this about LimitNOFILE:

Don't use. Be careful when raising the soft limit above 1024, since select(2) cannot function with file descriptors above 1023 on Linux. Nowadays, the hard limit defaults to 524288, a very high value compared to historical defaults. Typically applications should increase their soft limit to the hard limit on their own, if they are OK with working with file descriptors above 1023, i.e. do not use select(2). Note that file descriptors are nowadays accounted like any other form of memory, thus there should not be any need to lower the hard limit. Use MemoryMax= to control overall service memory use, including file descriptor memory.

-- 
Jonathan Billings
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux