webman的 total_request 每个进程请求数不均匀

Tinywan

问题描述

截图

服务器配置:4H 16G

"workerman/webman-framework": "^1.5",

进程跟踪

strace -ttp 4433

21:32:21.965415 epoll_wait(3, [{EPOLLIN, {u32=8, u64=8}}], 32, 29188) = 1
21:32:21.965457 recvfrom(8, "", 65535, 0, NULL, NULL) = 0
21:32:21.965484 epoll_ctl(3, EPOLL_CTL_DEL, 8, 0x7ffe573b766c) = 0
21:32:21.965509 close(8)                = 0
21:32:21.965548 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29188) = 1
21:32:22.002752 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.002804 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29152) = 1
21:32:22.031103 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.031148 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29124) = 1
21:32:22.035777 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.035818 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29116) = 1
21:32:22.036779 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.036823 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29116) = 1
21:32:22.082016 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.082066 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29072) = 1
21:32:22.119138 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.119184 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29036) = 1
21:32:22.121214 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.121266 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29032) = 1
21:32:22.126434 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.126574 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 29028) = 1
21:32:22.500116 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:22.500176 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 28652) = 1
21:32:23.221667 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:23.221741 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 27932) = 1
21:32:23.750820 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:23.750892 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 27404) = 1
21:32:24.159244 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:24.159292 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 26996) = 1
21:32:24.932295 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:24.932373 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 26220) = 1
21:32:24.970338 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:24.970402 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 26184) = 1
21:32:26.190964 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:26.191052 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 24964) = 1
21:32:26.227198 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
21:32:26.227262 epoll_wait(3, [{EPOLLIN, {u32=4, u64=4}}], 32, 24928) = 1
21:32:28.602363 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)

lsof -p 4433|grep 3

php     4433  www    3u  a_inode      0,13        0     10593 [eventpoll]
595 3 1
3个回答

walkor 打赏

请求数不一致是什么意思?是说每个进程请求数不均匀么?

  • Tinywan 2024-01-23

    嗯,刚上的一个新项目,好奇怪

  • Tinywan 2024-01-23

    每个进程请求数不均匀么

  • walkor 2024-01-23

    不平均正常,并不是请求数平均是最优的,系统会在尽量减少进程切换开销的情况下处理请求。
    如果你要平均的话需要在config/server.php里开启reuse_port

  • Tinywan 2024-01-23

    嗯嗯,确实看到了,其他项目我都是配置了'reusePort' => true, 刚上线新项目配置是'reusePort' => false。那这个配置项推荐使用那个,老大!

  • walkor 2024-01-23

    对业务影响不大,都行

  • Tinywan 2024-01-23

    好的

Tinywan

这是另外一个项目,都是均匀的

截图

4H 8G

  • 暂无评论
army

总感觉你们的内存占用都好多,莫非又是我姿势不对?

  • Tinywan 2024-01-25

    有点夸张,2.几

  • army 2024-01-25

    对啊,奇了怪了,我寻思我这项目也不算小哇 😄

  • army 2024-01-25

    对了,我全用的静态方法,不知道是不是这个原因

  • Tinywan 2024-01-25

    可能和这个有关系,可以分享一波

×
🔝