Operating System - Linux
1827459 Members
4638 Online
109965 Solutions
New Discussion

increate the valume of open_max_hard and open_max_soft

 
SOLVED
Go to solution
Shardha
Valued Contributor

increate the valume of open_max_hard and open_max_soft

Hi,

Any body knows how to increase valume of open_max_hard parameter, step by step.

Shardha
4 REPLIES 4
Steven E. Protter
Exalted Contributor
Solution

Re: increate the valume of open_max_hard and open_max_soft

Shalom,

if its a normal kernel parametr, ie one that is already present in /proc, overwrite it with an echo. echo 3334343 > shmmax for example.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vitaly Karasik_1
Honored Contributor

Re: increate the valume of open_max_hard and open_max_soft

Shardha,

If you are speaking about "max open files" parameters, you should tune them using

/etc/security/limits.conf

It's "nofile" parameters.
Shardha
Valued Contributor

Re: increate the valume of open_max_hard and open_max_soft

As per Hp documentation the procedure is given below, but i am not able to understand the exact steps.

Shardha


http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V40F_HTML/AQ0R3GTE/CHLMTSXX.HTM









5.5.2 Increasing the Maximum Number of Open File Descriptors
You can increase the maximum number of open file descriptors for all processes or for a specific application.

The proc subsystem attributes open-max-soft and open-max-hard control the maximum system-wide number of open file descriptors (open files) for each process. These attributes prevent runaway allocations, such as allocations within a loop that cannot be exited because of an error condition, from consuming all of the available file descriptors. If a process reaches the open-max-soft limit, a warning message is issued. If a process reaches the open-max-hard limit, the process is stopped.

The default value of the open-max-soft and open-max-hard attributes is 4096, which is the maximum system-wide value that you can set in the /etc/sysconfigtab file.

If you have an application that requires many open files, you can increase the open file descriptor limit only for that application, instead of increasing the system-wide limit. To enable extended (64 KB) file descriptors for a specific application, follow these steps:

1. Set the setsysinfo system call's SSI_FD_NEWMAX operation parameter to 1, which sets the utask bit, enables up to 65,536 (64 KB) open file descriptors, and raises the process's hard file limit to 64 KB. This setting is inherited by any child process. See setsysinfo(2) for more information.

2. Set the process's file descriptor soft limit to a value that is more than 4096 (the default value) by using the setrlimit function as shown in the following code fragment:

3.
4. #include
5. struct rlimit *rlp;
6.
7. rlp->rlim_cur = 6000;
8. rlp->rlim_max = 6000;
9. setrlimit(RLIMIT_NOFILE, rlp);
This setting is inherited by any child process. See setrlimit(2) for more information.

10. This step is required only for applications that use the select function's fd_set parameter, which points to an I/O descriptor set, and a FD_CLR, FD_ISSET, FD_SET, or FD_ZERO macro and can modify an I/O descriptor set. If you meet these qualifications, you can use one of two procedures, one that enables a static definition of the maximum number of file descriptors or one that enables a dynamic definition:

o Static definition:

Override the default value of 4096 for FD_SETSIZE in the header file by specifying the maximum value of 65536. You must specify this value before you include the header file (which also includes the header file) in the code, as follows:


#define FD_SETSIZE 65536
#include
This setting is not inherited by child processes; therefore, FD_SETSIZE must be set explicitly in the code for each child process that requires 64 KB file descriptors.

o Dynamic definition:

Instead of using statically-defined fd_set structures, you can use fd_set pointers in conjunction with a malloc function, which provides forward compatibility with any future changes to the maximum file descriptor limit. For example:


fd_set *fdp;

fdp = (fd_set *) malloc(
(fds_howmany(max_fds,FD_NFDBITS))*sizeof(fd_mask));
The value for max_fds is the number of file descriptors to be manipulated. It is recommended that you use the file descriptor soft limit for this value. All other keywords are defined in the header file. The following code segment shows this choice:


#include
#include

my_program()
{
fd_set *fdp;
struct rlimit rlim;
int max_fds;

getrlimit(RLIMIT_NOFILE, &rlim;);
max_fds = rlim.rlim_cur;

fdp = (fd_set *) malloc(
(fds_howmany(max_fds,FD_NFDBITS))*sizeof(fd_mask));

FD_SET(2, fdp);

for (;;) {
switch(select(max_fds, (fd_set *)0, fdp, (fd_set
*)0,
struct timeval *)0)) {
...
}
In addition, the vfs subsystem attribute max-vnodes must be set high enough for the needs of any application that requires a high number of descriptors. The max-vnodes attribute specifies the number of vnodes (open files), and is set to 5 percent of system memory by default. The recommended setting is 1 vnode for each file descriptor. See Section 5.5.1 for more information.

See Section 4.4 for information about modifying kernel subsystem attributes.

To disable support for up to 64 KB file descriptors for an application, set the setsysinfo system call's SSI_FD_NEWMAX operation parameter to 0, which disables the utask bit and returns the hard file limit to the default maximum of 4096 open file descriptors. However, if the process is using more than 4096 file descriptors, the setsysinfo system call will return an EINVAL error. In addition, if a calling process's hard or soft limit exceeds 4096, the limit is set to 4 KB after the call is successful. This setting is inherited by any child process.

Vitaly Karasik_1
Honored Contributor

Re: increate the valume of open_max_hard and open_max_soft

now I see - you're speaking about non-linux system.
you should ask this q. in another forum.