??????????Linux?????Java????????????????????"Too many open files"?????????

???????????????????????????????????????????????????????????????????socket??Linux?ж??????file????????????????????file??name??location??access authority?????????????????????屻???file entry??“open files table”????г????????洢??Щfile entry???????????????????????????????file descriptor??????????open files table????????open files table???±?????????????????????????????????????????

????????????ж??????file descriptor table????????????????(open or create)??????????????????????????open files table???????file entry?????????????open files table?????????file entry??Linux??????open files table??????????????????????????????????????????????????Too many open files?????????????????????????????

??????????

??????????????????????Ч??????????????????????????

????1??cat /proc/sys/fs/file-max

????2??sysctl -a ???????fs.file-max?????????????

?????????????????????????/etc/sysctl.conf?????????fs.file-max?????????????????????

???????????????sysctl -p??????????????????

???????????

????Linux???????????????????????????????? ulimit -n?????????Ч???á???????????????? ulimit -n <setting number> ???

??????????????????????????????????????2???????ο????統(tǒng)????????????????1024?????????2048??????????????????4096???????????

?????????Too many open files?????????????????????????????????????socket???????????????λ?????????Java???????????Java??????????????????????????????

    lsof -p $java_pid ?????????????????????
    lsof -p $java_pid | wc -l ???Java????file descriptor table??FD??????

????????????????????ж???????????????????????????