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就會發(fā)現(xiàn)狀態(tài)是busy, 日志顯示出現(xiàn)過exit with status 9
strace查看顯示一直在發(fā)送,也沒有卡頓。
現(xiàn)在需要查原因,怎么解決?
busy是業(yè)務(wù)在做慢業(yè)務(wù),不一定是阻塞,比如foreach 1000次,每次0.01秒,整個過程也要10秒,進(jìn)程也顯示busy。
exit with status 9 也是因為進(jìn)程在做慢業(yè)務(wù),收到relaod、restart、stop信號后一直不退出被kill掉了
如果一個客戶端發(fā)過來一次數(shù)據(jù),服務(wù)端在處理這個客戶端的數(shù)據(jù)的時候其他客戶端發(fā)過來數(shù)據(jù)是不是要等前一個處理完才能處理第二個?還是并行?
這種如果要優(yōu)化的話就是進(jìn)程多開幾個?服務(wù)器12核,現(xiàn)在開的是2個。我看說的是進(jìn)程數(shù)量可以和cpu數(shù)量相同
對,businessworker進(jìn)程同一個進(jìn)程收到多個請求,要處理完一個才能處理下一個。gateway進(jìn)程是非阻塞的,能并發(fā)轉(zhuǎn)接多個請求給businessworker進(jìn)程。
一個gateway進(jìn)程可以輕松處理5000個連接,1萬在線就開2個gateway,2萬在線開4個,gateway不宜開太多。
businessWorker可以多開一些,比如cpu的2倍。如果業(yè)務(wù)數(shù)據(jù)庫操作或者有curl操作就多開一些,比如cpu 4-6倍。
服務(wù)器CPU12核,現(xiàn)在數(shù)據(jù)庫和項目都是用的容器跑的,都在這一臺服務(wù)器上,socket businessworker有些事件要處理數(shù)據(jù)庫,大部分都是查詢。這種的開gateway和businessworker進(jìn)程數(shù)量多少合適。目前每日最多同時在線不到一千。