Troubleshooting "too many open files'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



----- Original Message ----- 
From: "Michael Rock" <mikerocks65@xxxxxxxxx>
To: <centos@xxxxxxxxxx>
Sent: Sunday, May 07, 2006 12:40 AM
Subject:  Troubleshooting "too many open files'


> ulimit -n was 1024, so I am assuming that is likely
> the problem.  So if I understand your reply correctly,
> I can do a 'ulimit -n 8192' to increase the value, but
> that is only for the session?
>
> Since I have the program starting at bootup what you
> are saying is I need to edit these files and reboot,
> Then ulimit -n should show whatever I set it to below?
>
> FD_SETSIZE defined in:
> /usr/include/linux/posix_types.h
> /usr/include/bits/typesizes.h
>
> #define __FD_SETSIZE    8192
>
> Do I have that right? thx


I have always used ulimit -HSn 8192 in the startup of the program.  for 
example, I used it in /etc/rc.d/init.d/squid like so:

<SNIP>
start() {
    ulimit -HSn 8192
    echo 8192 > /proc/sys/fs/file-max
    echo 1024 32768 > /proc/sys/net/ipv4/ip_local_port_range
    echo 4096 > /proc/sys/net/ipv4/tcp_max_syn_backlog

    for adir in $CACHE_SWAP; do
        if [ ! -d $adir/00 ]; then
             echo -n "init_cache_dir $adir... "
             $SQUID -z -F -D 2>/dev/null
</SNIP>

Also,
You might have to re-compile the program so that it can use these settings. 
I have to re-compile squid with these values entered or it defaults to 1024.

HTH

-Marco


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux