Has anyone been able to configure the kernel to allow a large number of
sockets per proccess?
I am interested in having more than 20,000 open sockets on my linux box.
I did the following and was able to get about 16393 sockets before:
kernel: VFS: No free inodes - contact Linus
include/linux/fs.h:
/* Fixed constants first: */
#define NR_OPEN 30000
#define NR_INODE 32768 /* this should be bigger than NR_FILE */
#define NR_FILE 30000 /* this can well be larger on a larger
system */
include/linux/limits.h:
#define NR_OPEN 30000
#define OPEN_MAX 30000 /* # open files a process may have
*/
include/linux/posix_types.h:
#define __FD_SETSIZE 32768
/*
** Test program.
*/
#include <sys/types.h>
#include <sys/socket.h>
main()
{
int i, s;
for(i=0; i<30000; i++)
if( (s=socket(AF_INET, SOCK_STREAM, 0)) < 0 )
{ perror("socket"); break; }
else
printf("%d: %d\n", i, s);
Quote:}