Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rabbitmq File Descriptor Limit

Rabbitmq documentation says that we need to do some configuration before we use it on production. One of the configuration is about maximum open file number (which is an OS parameter).

Rabbitmq server we use is running on Ubuntu 16.04 and according to resources I found on web, I updated the number of open files as 500k. When I check it from command line, I get the following output:

root@madeleine:~# ulimit -n
500000

However when I look at the rabbitmq server status, I see another number.

root@madeleine:~# rabbitmqctl status | grep 'file_descriptors' -A 4
 {file_descriptors,
     [{total_limit,924},
      {total_used,19},
      {sockets_limit,829},
      {sockets_used,10}]},

It seems like, I managed to increase the limit on OS side, but rabbitmq still thinks that total limit of file descriptors is 924.

What might be causing this problem?

like image 465
faruk.kuscan Avatar asked Sep 15 '17 12:09

faruk.kuscan


People also ask

Is file descriptor a limit?

Thus, we know that this system's hard limit for the number of open file descriptors is 4096.

Why is there a file descriptor limit?

A Too many open files error happens when a process needs to open more files than the operating system allows. This number is controlled by the maximum number of file descriptors the process has. If you experience such an issue, you can increase the operating system file descriptor limit.

How much memory does RabbitMQ use?

Nodes hosting RabbitMQ should have at least 256 MiB of memory available at all times. Deployments that use quorum queues, Shovel and Federation may need more.


2 Answers

You might want to look at this page

Apparently, this operation depends on the OS version. If you have a systemd, you should do the following in /etc/systemd/system/rabbitmq-server.service.d/limits.conf file:

Notice that this service configuration might be somewhere else according to the operating system you are using. You can use the following command to find where this service configuration is located and update that file.

find / -name "*rabbitmq-server.service*"

[Service]

LimitNOFILE=300000

On the other hand, if you do not have the systemd folder, you should try this in your rabbitmq-env.conf file:

ulimit -S -n 4096

like image 182
ahmetcetin Avatar answered Sep 28 '22 06:09

ahmetcetin


Increase / Set maximum number of open files

sudo sysctl -w fs.file-max=65536
These limits are defined in /etc/security/limits.conf

sudo nano /etc/security/limits.conf
and set

soft nofile 65536
hard nofile 65536
Per user settings for rabbitmq process can also be set in /etc/default/rabbitmq-server

sudo nano /etc/default/rabbitmq-server
and set

ulimit -n 65536
Then reboot the server for changes to take effect.

like image 30
ilker Kopan Avatar answered Sep 28 '22 08:09

ilker Kopan