Tuesday, April 20, 2010

increase socket/file open limit in linux

for temporary setting for file max

sysctl -w fs.file-max=100000

for permanent setting

echo "fs.file-max = 10000" >> /etc/sysctl.conf

sysctl -p

for open files

[root@rtapp5in bin]#ulimit -a

[root@rtapp5in bin]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 71680
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 71680
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

[root@rtapp5in bin]# ulimit -n unlimited
-bash: ulimit: open files: cannot modify limit: Operation not permitted

make changes in /etc/security/limits.conf

add following lines

* soft nofile unlimited
* hard nofile 65535

1 comment:

  1. Just remember that if you do this, you risk running into limitations with the select() API. http://beesbuzz.biz/blog/e/2013/10/10-the_problem_with_select_vs_poll.php

    ReplyDelete

Followers

About Me

My photo

My Name is Yogesh Malik, I am working in Times Group.