2023-07-22 03:35:42 pid:1131823 Workerman[start.php] status
2023-07-22 03:35:51 pid:1132145 Workerman[start.php] status
2023-07-22 03:35:57 pid:1132465 Workerman[start.php] status
2023-07-22 03:36:00 pid:1132647 Workerman[start.php] status
2023-07-22 03:36:03 pid:1132814 Workerman[start.php] status
2023-07-22 03:36:06 pid:1132942 Workerman[start.php] status
2023-07-22 03:36:43 pid:1134857 Workerman[start.php] status
2023-07-22 03:36:45 pid:1134972 Workerman[start.php] status
2023-07-22 03:38:01 pid:1137261 Workerman[start.php] reload
2023-07-22 03:38:01 pid:56 Workerman[start.php] reloading
2023-07-22 03:38:03 pid:1137267 Workerman[start.php] status
2023-07-22 03:39:43 pid:1137438 Workerman[start.php] status
2023-07-22 03:46:56 pid:1149746 Workerman[start.php] status
2023-07-22 03:47:05 pid:1149748 Workerman[start.php] status
2023-07-22 03:59:34 pid:1173101 Workerman[start.php] status
2023-07-22 03:59:41 pid:1173477 Workerman[start.php] status
2023-07-22 03:59:52 pid:1174094 Workerman[start.php] status
2023-07-22 04:00:00 pid:1174500 Workerman[start.php] reload
2023-07-22 04:00:00 pid:56 Workerman[start.php] reloading
2023-07-22 04:00:02 pid:1174612 Workerman[start.php] status
2023-07-22 04:00:02 pid:56 worker[ChatBusinessWorker:1137262] exit with status 9
2023-07-22 04:00:04 pid:1174693 Workerman[start.php] status
2023-07-22 04:00:04 pid:56 worker[ChatBusinessWorker:1137263] exit with status 9
2023-07-22 04:00:07 pid:1174767 Workerman[start.php] status
2023-07-22 04:00:09 pid:1174828 Workerman[start.php] status
2023-07-22 04:00:11 pid:1174885 Workerman[start.php] status
2023-07-22 04:00:13 pid:1174949 Workerman[start.php] status
2023-07-22 04:00:15 pid:1175014 Workerman[start.php] status
2023-07-22 04:03:54 pid:1177115 Workerman[start.php] status
2023-07-22 04:03:57 pid:1177185 Workerman[start.php] status
过一会查看status就会发现状态是busy, 日志显示出现过exit with status 9
strace查看显示一直在发送,也没有卡顿。
现在需要查原因,怎么解决?
busy是业务在做慢业务,不一定是阻塞,比如foreach 1000次,每次0.01秒,整个过程也要10秒,进程也显示busy。
exit with status 9 也是因为进程在做慢业务,收到relaod、restart、stop信号后一直不退出被kill掉了
如果一个客户端发过来一次数据,服务端在处理这个客户端的数据的时候其他客户端发过来数据是不是要等前一个处理完才能处理第二个?还是并行?
进程内串行,进程间并行
也就是同一个进程收到的多个请求,要一个处理完才处理下一个呗
这种如果要优化的话就是进程多开几个?服务器12核,现在开的是2个。我看说的是进程数量可以和cpu数量相同
对,businessworker进程同一个进程收到多个请求,要处理完一个才能处理下一个。gateway进程是非阻塞的,能并发转接多个请求给businessworker进程。
一个gateway进程可以轻松处理5000个连接,1万在线就开2个gateway,2万在线开4个,gateway不宜开太多。
businessWorker可以多开一些,比如cpu的2倍。如果业务数据库操作或者有curl操作就多开一些,比如cpu 4-6倍。
服务器CPU12核,现在数据库和项目都是用的容器跑的,都在这一台服务器上,socket businessworker有些事件要处理数据库,大部分都是查询。这种的开gateway和businessworker进程数量多少合适。目前每日最多同时在线不到一千。