Comment 0 for bug 1526992

Revision history for this message
Alexander Bozhenko (alexbozhenko) wrote :

We have this file:
cat /etc/security/limits.conf
# Raising open file limit for OpenStack services
* soft nofile 102400
* hard nofile 112640

In centos 6 an 7 those limits are applied for users, including root.

[root@centos-1gb-nyc3-01 ~]# ulimit -Ha | grep open
open files (-n) 112640
[root@centos-1gb-nyc3-01 ~]# ulimit -Sa | grep open
open files (-n) 102400

On ubuntu manpage says this:
           NOTE: group and wildcard limits are not applied to the root user. To set a limit for the root user, this field
           must contain the literal username root.
And ulimits are not applied to root:
root@:~# ulimit -Ha | grep open
open files (-n) 4096
root@:~# ulimit -Sa | grep open
open files (-n) 1024

So to limits.conf need to add this as well for ubuntu, if we need it for root:
root soft nofile 102400
root hard nofile 112640

Also, options from limits.conf are not applied to upstart jobs in Ubuntu, and to sysvinit scripts in centos6 and systemd in centos7.
They are only applied for process started from shell under particluar user.
You can check it by doing
cat /proc/PID/limits
Some services have default ulimit values.

So, if we really need that ulimit set for openstack services we need to add ulimits to upstart jobs for ubuntu:
http://stackoverflow.com/a/19996195
http://upstart.ubuntu.com/wiki/Stanzas#limit
E.g. Mongodb is doing that. Check
cat /etc/init/mongodb.conf | grep limit
limit nofile 64000 64000

For cenots 6 it is similar syntax, see http://serverfault.com/a/624107

And for centos7 it is in systemd:
[root@localhost ~]# cat /usr/lib/systemd/system/mongod.service | grep -i limit
LimitNOFILE=64000