• Webconn Technology
    • GPU Server
      • Dedicated GPU Servers with NVIDIA RTX/A100 GPUs for accelerated AI training, rendering, and scientific computing. Features CUDA cores, 24GB-141GB VRAM, and parallel processing. Pre-configured with TensorFlow/PyTorch.

      • nvidia rtx A6000
    • Dedicated Server
      • Experience blazing-fast speeds & ironclad security with your own dedicated server. No shared resources. Fully customizable plans for gaming, e-commerce, and big data. Start now!

      • datacenter
    • Shared Hosting
      • Get user-friendly DirectAdmin shared hosting for your website. Enjoy an intuitive control panel, one-click app installs, and reliable performance. Perfect for blogs, small business sites, and portfolios.

      • shared hosting web
    • Domains
      • Search and register the perfect domain name for your website. Get a memorable .com, .net, .org or niche TLD to start building your brand online. Includes free privacy protection.

    • VPS
      • Experience the power of a dedicated server without the high cost. Our VPS hosting guarantees CPU, RAM, and storage for your site, ensuring optimal performance and stability.

      • data center
  • Blog
  • Dashboard

How to increase number of open files limit in CentOS 5,6, and 7

When load testing an application and seeing “Resource temporarily unavailable” issues, increase the “nofile” and system-wide limitations for the number of open files.

The kernel allows a certain amount of continuously open file descriptors. This number will automatically vary depending on the amount of RAM in the system by default.

In the file /etc/sysctl.conf, edit/add the following kernel parameter.

# vi /etc/sysctl.conf
fs.file-max = XXXXX

For applying the above changes execute.

# sysctl -p

The current value of the max-open-files limit can be found by.

# cat /proc/sys/fs/file-max
or
# sysctl -a | grep fs.file-max

Ulimit gives the user control over the resources available to the shell and the processes it starts. Per-process file descriptor limits apply to each user. 1024 is the default value. This can only be changed by root.

# ulimit -n
1024
# su - root
# ulimit -n 16384 
# ulimit -n
16384

To make the change permanent, edit the following file.

  • For Single User:
# vi /etc/security/limits.conf
<username> soft nofile 4096
<username> hard nofile 10240

Then save changes with :wq

Verify the changes as follows.

# su - username
# ulimit -Sn
4096
# ulimit -Hn
10240
  • For all users use wild card ‘*’ instead of username
# vi /etc/security/limits.conf
* soft nofile 4096
* hard nofile 10240

Then save changes with :wq

Comments

Leave a Reply