Sunday, October 28, 2012

Open File Descriptor- Happy Tuning

What is a File Descriptor in Linux?
As per dictionary.com literal meaning of descriptor is an element or term that has the function of describing something specific.
In Linux Operating System a file descriptor stand for an interaction between a process and an opened file, while an open file object has information related to that interaction.
Numerous processes could simultaneously open the same file. In that scenario, the filesystem assigns a separate file descriptor to each file, along with a separate open file object.
Under Linux OS-  fd indicates the file descriptor of the opened file. There is a default limit for maximum number of file descriptors that an individual process could open and in Linux it is 1024.
Kind of less :(
At times this max limit could be a bottle neck for some java apps so we use ulimit to tune it.

ulimit -aS displays the soft limit, and ulimit -aH displays the hard limit

Example:

# su - httpd

# ulimit -Hn

# ulimit -Sn


Tuning Open file descriptor max limits

# echo “fs.file-max=95000″ >> /etc/sysctl.conf

# sysctl –p

 # echo “* hard nofile 95000″ >> /etc/security/limits.conf

# echo “* soft nofile 1024″ >> /etc/security/limits.conf

# echo “session required /lib/security/pam_limits.so” >> /etc/pam.d/login

#ulimit -n unlimited

:) Happy Tuning

No comments:

Post a Comment