Linux内核调优,让系统支持更大并发--workman框架的教程

https://www.workerman.net/doc/workerman/appendices/kernel-optimization.html

 

php查询服务器CPU核心数量:

function getCpuCores() {
if (is_file('/proc/cpuinfo')) {
$cpuinfo = file_get_contents('/proc/cpuinfo');
preg_match_all('/^processor/m', $cpuinfo, $matches);
return count($matches[0]);
}
return 1; // 默认返回 1 个核心
}

echo "CPU 核心数量: " . getCpuCores();

posted @ 2025-03-19 16:52  幽暗天琴  阅读(20)  评论(0)    收藏  举报