壓測游戲服務(wù)器的時候,發(fā)現(xiàn)好幾個服務(wù) socket 提示 too many open files ,并且加載文件和讀取數(shù)據(jù)庫都失敗。估計是 fd 上限設(shè)置的太小了。
使用 ulimit -a 檢查,看到 open files 的值才1024。果然。
修改方法如下,在文件/etc/security/limits.conf 的最后添加
* hard nofile 500000
* soft nofile 500000
root hard nofile 500000
root soft nofile 500000
參考 https://www.baeldung.com/linux/error-too-many-open-files#file-descriptor-limits