Cannot increase the number of file descriptors beyond 4096

953 views
Skip to first unread message

Nate Meyer

unread,
Mar 17, 2015, 7:10:44 PM3/17/15
to rabbitm...@googlegroups.com
Hi folks,

I'm playing around with RabbitMQ (RabbitMQ 3.4.4, Erlang 17.4) in a CentOS 7 vm. I'm trying to increase the number of file descriptors available by adjusting the ulimit command in /etc/rabbitmq/rabbitmq-env.conf. Strangely, if I restart the service with any value greater than 4096 it remains set at the default (1024).

There should be enough file_descriptors globally:

[root@default-centos-70 ~]# cat /proc/sys/fs/file-max
99900

And I've updated /etc/rabbitmq/rabbitmq-env.conf:

[root@default-centos-70 ~]# grep ulimit /etc/rabbitmq/rabbitmq-env.conf
ulimit -n 65536

And after restarting the RabbitMQ service the defaults are set:

[root@default-centos-70 ~]# rabbitmqctl status | grep -A 1 file_desc
 {file_descriptors,
     [{total_limit,924},{total_used,3},{sockets_limit,829},{sockets_used,1}]},

If I use any value <= 4096 RabbitMQ will happily use the given value. Am I missing something here?

Thanks!
Nate

Michael Klishin

unread,
Mar 17, 2015, 7:21:47 PM3/17/15
to rabbitm...@googlegroups.com, Nate Meyer
 On 18 March 2015 at 00:10:46, Nate Meyer (nme...@gmail.com) wrote:
> If I use any value <= 4096 RabbitMQ will happily use the given
> value. Am I missing something here?

4096 is the default hard limit for file descriptors.

On CentOS you need to adjust /etc/security/limits.conf, see [1] and a couple of CentOS-specific
remarks.

We've taken a few rounds with documenting this on rabbitmq.com but there are enough subtle distro-specific
issues to make this impossible (unless we want to document Linux, which sounds a bit out of scope).

1. http://docs.basho.com/riak/latest/ops/tuning/open-files-limit/
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Nate Meyer

unread,
Mar 17, 2015, 8:19:07 PM3/17/15
to Michael Klishin, rabbitm...@googlegroups.com
Thanks for the info. You were right about it being the hard limit. For posterity and any other systemd users that run across this down the road, I solved it with a systemd drop-in file. Just create this:

[root@default-centos-70 ~]# cat /etc/systemd/system/rabbitmq-server.service.d/open_files.conf
[Service]
LimitNOFILE=65536

It will set both the hard and soft limits just for RabbitMQ. All will be well after restarting the service.

Thanks again Michael!

Hui Kang

unread,
Mar 17, 2016, 6:39:42 PM3/17/16
to rabbitmq-users, mkli...@pivotal.io
I put the file # cat /etc/systemd/system/rabbitmq-
server.service.d/open_files.conf
[Service]
LimitNOFILE=65536

for rabbitmq-server 3.5.7 on a centos 7.2 and restart the rabbitmq-server. However, the output of rabbitmqctl gives me

{file_descriptors,
     [{total_limit,10140},
      {total_used,77},
      {sockets_limit,9124},
      {sockets_used,75}]},
 {processes,[{limit,1048576},{used,1253}]},
 {run_queue,0},
 {uptime,11}]

Did I miss anything? Thanks. - Hui

Michael Klishin

unread,
Mar 17, 2016, 6:42:40 PM3/17/16
to Hui Kang, rabbitmq-users
Open file handles limit is controlled via sysctl. I am not sure if systemd tries to manage
that but sysctl is a sure way to do it:
http://docs.basho.com/riak/latest/ops/tuning/open-files-limit/  
Reply all
Reply to author
Forward
0 new messages