• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1591
  • Last Modified:

Too Many Open Files

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
1 Solution
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
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

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now