Re: Opening 5000 file descriptors in linux??

Christopher E. Brown (cbrown@denalics.net)
Tue, 30 Mar 1999 18:25:29 -0900 (AKST)


On Tue, 30 Mar 1999, Richard B. Johnson wrote:

> On Tue, 30 Mar 1999, Gerold Jury wrote:
> This shows that you can open 1021 sockets on my machine. Since 3
> fds are already open, the default limitation seems to be 1024 as
> expected.
>
> #include <stdio.h>
> #include <sys/socket.h>
>
> main()
> {
> int s;
> for(s = 0;; s++)
> if(socket(AF_INET,SOCK_STREAM,0) <0) break;
> printf("%d\n", s);
> }

The default limit is 1024 fh. ulimit -n will reset this. *note*,
a normal user CANNOT increase their own fh limit.

After

echo 32768 > /proc/sys/fs/file-max # increase default system wide from 4096
echo 131072 > /proc/sys/fs/inode-max # boost system wide inodes too

ulimit -n 32768 #change roots fh limit

I get 32285 opened...

Whatever script calls your program should increase the default fh limit
before it starts the program as a normal user.

----
As folks might have suspected, not much survives except roaches,
and they don't carry large enough packets fast enough...
--About the Internet and nuclear war.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/