mina框架出现too many open files解决办法

当mina nio产生大量socket,而且底层的socket长期处于Time_Wait状态

用netstat -p

可以查看

 

就会产生too many open files异常。

此时,在程序启动脚本加入

ulimit -SHn 30000

注:红色部分自定义

 

扩大linux文件打开数量,问题解决。

或者修改socket的等待时常。

 

apache的官方解决办法:

you may have a too low ulimit setup. It defaults to 1024, and each time you open a socket, that eats a file descriptor.

You have options, though :
> - either you increase this ulimit, or set it to unlimited,
> - or you lower the tcp-time-wait value so that the sockets are closed faster.

 

 

你可能感兴趣的:(框架,linux,socket,脚本,Mina)