How to Fix Too Many Open Files in Ubuntu Linux

Home » How to Fix Too Many Open Files in Ubuntu Linux

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
How to Fix Too Many Open Files in Ubuntu Linux

Linux customers regularly run over the screw-up, ‘Too Many Open Files’ a result of high weight in the server. Leaving it hard for us to open various records. How to Fix Too Many Open Files in Ubuntu Linux?

Blue And White Modern Creative Digital Marketing Outdoor Banner

We, at ARZHOST, have experienced a similar error and our Server Administration Team has composed fruitful plans.

Today, we must take a gander at how to notice the limitation of the most notable number of open records set by Linux. “Ubuntu Too Many Open Files”, how we change it for an entire host, individual help, or a current gathering.

Where might we have the option to find the error, ‘ Open Files in Ubuntu Linux

Since Linux has drawn the biggest open record line. The system has a procedure for limiting the number of various resources a cycle can eat up.

For the most part the “Ubuntu Too Many Open Files”, screw up is found on servers with a presented NGINX/httpd web server or an informational collection server (MySQL/Maria DB/PostgreSQL).

For example, when an Nginx web server outperforms the open archive limit. We run over an error:

  • connection () failed (29: Too many open archives) while communicating with upstream

To notice the most outrageous number of record descriptors a structure can open. Run the going with the request:

  • # cat/proc/sys/fs/report max

The open report limit for a current customer is 1024. We can really view at it as follows:

  • # ulimit - n [root@server/] # cat/proc/sys/fs/record max 97816 [root@server/] # ulimit - n 1024

There are two limit types. Hard and Soft. Any customer can change sensitive cutoff regard anyway an inclined toward or root customer can modify a hard limit regard. Well, quite far worth can’t outperform beyond what many would consider possible worth.

To show quite far worth. “Ubuntu Too Many Open Files”, run the request:

  • # ulimit – nS

To show quite far worth:

  • # ulimit - NH

‘Too Many Open Files’ error and Open File Limits in Linux

By and by we understand that these titles infer that a cycle has opened such countless archives (record descriptors) and can’t open new ones. “Ubuntu Too Many Open Files”, In Linux, the most shameful open record limits are set as is normally done for each cycle or customer and the characteristics are nearly nothing.

We, here at have noticed this excitedly and have thought about two or three plans:

1: Increase the Max Open File Limit in Linux

Endless records can be opened accepting we change the cutoff focuses in our Linux OS. To make new settings very tough and thwart their reset later a server or meeting restart, make changes to, etc/security/limits.conf. by adding these lines:

  • hard nofile 97816
  • fragile file 97816

If it is using Ubuntu. “Ubuntu Too Many Open Files”, add this line too:

  • meeting required

These limits grant to draw open record lines later customer check. Ensuing to carrying out the upgrades, reload the terminal and check the max_open_files regard:

  • # ulimit - n 97816

2: Increase the Open File Descriptor Limit per organization

A change of the limitation of open record descriptors for specific help, rather than for an entire working system is possible.

For example, if we take Apache, to change the cutoff focuses, open the help settings using systemctl:

  • systemctl adjust httpd. Service

At the point when the help settings are open. “Ubuntu Too Many Open Files”, add the cutoff focuses required. For example:

  • [Service] LimitNOFILE=16000 LimitNOFILESoft=16000

Following carrying out the upgrades. Update the help plan and restart it:

  • # systemctl daemon-reload # systemctl restart httpd. Service

To ensure the characteristics have changed. “Ubuntu Too Many Open Files”, Get the assistance PID:

  • # systemctl status httpd. Service

For example, accepting that the help PID is 3724:

  • # cat/proc/3724/limits | grep "Max open records"

Along these lines, we can change the characteristics for the most shocking number of open records for specific help.

3: Set forth Max Open Files Line for Nginx and Apache

Just as changing the limit on the number of open archives to a web server. We should change the help configuration record.

For example, show/change the going with request regard in the Nginx configuration record, etc/Nginx/Nginx. Conf:

  • worker_rlimit_nofile 16000

While planning Nginx on a significantly stacked 8-focus server with worker connections 8192. “Ubuntu Too Many Open Files”, We truly need to prove:

  • 8192*2*8 (vCPU) = 131072 in worker_rlimit_nofile

Then, restart Nginx. For apache, make a vault:

  • # mkdir/lib/system/structure/httpd. Service. d/

Then, make the LimitNOFILE. conf record:

  • # nano/lib/systemd/structure/httpd.service.d/limit_nofile.conf

Add to it:

  • [Service] LimitNOFILE=16000

Make sure to restart httpd.

4: Change the Open File Limit for Current Session

In any case, run the request:

  • # ulimit - n 3000

At the point when the terminal is closed and another gathering is made. “Ubuntu Too Many Open Files”, The cutoff focuses will get back to the primary characteristics showed in, etc/security/limits.conf.

To change the general motivating force for the structure/proc/sys/fs/record max. Change the fs. file-max regard in, etc/sysctl.conf:

  • file-max = 100000

Finally, apply:

  • # systole - p [root@server/] # systole - p net. ipv4.ip_forward = 1 fs. file-max = 200000 [root@server/] # cat/proc/sys/fs/record max 200000


To wrap up today at, we figured how our Hosting Expert Planners tackle the screw-up. “Ubuntu Too Many Open Files”, and inspected decisions to change quite far set by Linux.

We saw that the default worth of the open report descriptor limit in Linux is nearly nothing. discussed two or three decisions for changing these limitations of the server.

Some Related FAQS

Question # 1: How would I fix too many open documents in Ubuntu?

Answer: Increment the Max Open File Limit in Linux

An enormous number of documents can be opened assuming we change the cutoff points in our Linux OS. To make new settings super durable and forestall their reset later a server or meeting restart, make changes to/and so forth/security/limits. conf.

Question # 2: How would you fix too many open records in Linux?

Answer: Too many open documents message happens on UNIX and Linux working frameworks. The default setting for the most extreme number of open records may be excessively low. To stay away from this condition, increment the greatest open records to 8000: Edit the/and so forth/security/limit.

Question # 3: For what reason does Linux have such countless open records?

Answer: All the time ‘too many open documents’ mistakes happen on high-load Linux servers. It implies that interaction has opened an excessive number of records (document descriptors) and can’t open new ones. In Linux, the greatest open document limits are set of course for each interaction or client and the qualities are fairly little.

Question # 4: What causes too many open records?

Answer: “Too many open documents ” blunders happen when an interaction needs to open a bigger number of records than is permitted by the working framework. This number is constrained by the greatest number of document descriptors the cycle has. 2. Unequivocally set the number of document descriptors utilizing the limit order.



Share on facebook
Share on twitter
Share on pinterest
Share on linkedin
On Key

Related Posts