Increasing the number of file descriptors available to an application

File descriptors are used for more than just open files, they also provide the framework for socket i/o. The kernel dynamically allocates resources for open files. There is no maximum number of file descriptors per system.

Depending on the programming interface used, an application may not be able to reach the file descriptor limit.

API limits (ref:Solaris Internals)

Solaris 2.6

  • stdio(3S) - 256 From stdio(3S); no more than 255 files may be opened using fopen(), and only file descriptors 0 through 255 can be used in a stream.
  • select(3c) - 1024 From select(3c); The default value for FD_SETSIZE (currently 1024) is larger than the default limit on the number of open files. It is not possible to increase the size of the fd_set data type when used with select().

Solaris 7, 8, 9 and 10

  • stdio(3s) - 256 (32-bit) / 65536 (64-bit)
  • select(3c) - 1024 (32-bit) / 65536 (64-bit) 65536 limit is attainable on 32-bit Solaris 7 #define FD_SETSIZE 65536 ; prior to includes

System defaults

  • Solaris 2.6 / 7 rlim_fd_max 1024 rlim_fd_cur 64
  • Solaris 8 rlim_fd_max 1024 rlim_fd_cur 256
  • Solaris 9 / 10 rlim_fd_max 65536 rlim_fd_cur 256

Modify /etc/system

  • set rlim_fd_max=8192 ; hard limit (per process)
  • set rlim_fd_cur=1024 ; soft limit (per process)