Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (6.1k points)

I have a project where I had to create a multi-threaded server, and I am comparing it to apache by running some tests against it. I have an autobench to deal with this, but when I run a few tests, or if I give it too high of a rate around 600+ to establish the connections, it displays a "Too many open files" error.

When I am done dealing with requests, I run a close() on the socket. I was trying shutdown() function as well, but not helping me. Please help me to get out of it.

1 Answer

0 votes
by (11.7k points)

Multiple places are available where Linux puts a limit on the number of file descriptors we are allowed to open.

Check out the following:

cat /proc/sys/fs/file-max

It will show you the system-wide limits of file descriptors.

On the shell level, the personal limit is displayed:

ulimit -n

We can change it /etc/security/limits.conf - it's the nofile param.

But, if you try to close your sockets correctly, you will not receive this unless simultaneous connections are being opened. 

Related questions

0 votes
1 answer
asked Dec 10, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
asked Dec 17, 2020 in Linux by blackindya (18.4k points)

Browse Categories

...