Too Many Open Files

Posted on 1999-07-16
Medium Priority
Last Modified: 2013-12-27
I have written a server on Solaris using c++.
I was doing a load test when after 15 Mins with loads of
2 Messages to the server second, I get a socket error called
"Too Many Open file" and then a thread failure(which my program uses)
I am closing the connection for all the requests and the server processing time is very minimal.
Each Connection recieved from the client there is a thread created and the thread process these requests.
I would be glad to provide any further info if this problem can be solved
Question by:purple_net
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 2011540
You need to modify the kernel parameters for your system.  I'm an HP UNIX admin, so I'm pretty sure the names are not exactly the same on solaris, but chances are there is something very similar.

Go to the administrative program.  (HP's is called SAM.)  
Click on kernel configuration, then configurable parameters. Select "nfile" which is the number of open files and bump up to a higher number.  On our software development workstations, we currently use 1251.  Another
parameter "max_thread_proc" is 64.  Nproc (max no of processes) we have set to 532.

- Ron

Accepted Solution

rickyr earned 200 total points
ID: 2011541
make a copy of /etc/system beforeyou edit it. If you screw up this file your machine may not boot. The maxusers variable has nothing to do with the number of user allowed on a system. It's one big knob that scales a number of other parameters simultaneously. The standard settings and derivations are more or less as follows, using /etc/system syntax:

        * The big knob, scales automatically
        set maxusers = <amount of available physical memory in MB>

        * Maximum number of allowable processes; currently at most 30000
        set max_nprocs = 10 + 16 * maxusers

        * Max processes per user (5 are reserved for the super user)
        set maxuprc = max_nprocs - 5;

        * Number of quota structures (need one per user per filesystem
        * w/ quotas)
        set ndquot = maxusers * NMOUNT / 4 + max_nprocs

        * Maximum size of the directory name lookup cache (DNLC)
        set ncsize = 4 * (max_nprocs + maxusers) + 320
        set ufs_ninode = ncsize


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question