Comments (9)
You can use command strace -ttp pid
to find out what is the problem.
from gatewayworker.
@walkor In heavy load how strace can be usable?
from gatewayworker.
I see in a business worker when CPU usage is 100% , strace -ttp pidOfBW
log the following messages and stop logging until CPU usage goes down
09:07:53.573285 mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5736e00000
09:07:53.573466 madvise(0x7f5736e00000, 2097152, MADV_HUGEPAGE) = 0
09:08:00.839684 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
09:08:00.839772 rt_sigreturn({mask=[]}) = 0
and when CPU usage is higher than 90% I see this message logs at very high rate
09:08:43.833425 poll([{fd=213, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000) = 1 ([{fd=213, revents=POLLOUT}])
09:08:43.834045 getsockopt(213, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
09:08:43.834220 fcntl(213, F_SETFL, O_RDWR) = 0
09:08:43.834330 sendto(213, "\0\0\0m\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0{\"se"..., 142, 0, NULL, 0) = 142
09:08:43.834512 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 214
09:08:43.834594 fcntl(214, F_GETFL) = 0x2 (flags O_RDWR)
09:08:43.834688 fcntl(214, F_SETFL, O_RDWR|O_NONBLOCK) = 0
09:08:43.834812 connect(214, {sa_family=AF_INET, sin_port=htons(2305), sin_addr=inet_addr("10.10.10.11")}, 16) = -1 EINPROGRESS (Operation now in progress)
09:08:43.835136 poll([{fd=214, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000) = 1 ([{fd=214, revents=POLLOUT}])
09:08:43.835422 getsockopt(214, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
09:08:43.835494 fcntl(214, F_SETFL, O_RDWR) = 0
09:08:43.835541 sendto(214, "\0\0\0m\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0{\"se"..., 142, 0, NULL, 0) = 142
09:08:43.835620 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 215
09:08:43.835683 fcntl(215, F_GETFL) = 0x2 (flags O_RDWR)
09:08:43.835855 fcntl(215, F_SETFL, O_RDWR|O_NONBLOCK) = 0
09:08:43.835956 connect(215, {sa_family=AF_INET, sin_port=htons(2306), sin_addr=inet_addr("10.10.10.11")}, 16) = -1 EINPROGRESS (Operation now in progress)
09:08:43.836049 poll([{fd=215, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000) = 1 ([{fd=215, revents=POLLOUT}])
09:08:43.836344 getsockopt(215, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
09:08:43.836415 fcntl(215, F_SETFL, O_RDWR) = 0
09:08:43.836482 sendto(215, "\0\0\0m\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0{\"se"..., 142, 0, NULL, 0) = 142
09:08:43.836586 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 216
09:08:43.836794 fcntl(216, F_GETFL) = 0x2 (flags O_RDWR)
09:08:43.836851 fcntl(216, F_SETFL, O_RDWR|O_NONBLOCK) = 0
09:08:43.836917 connect(216, {sa_family=AF_INET, sin_port=htons(2307), sin_addr=inet_addr("10.10.10.11")}, 16) = -1 EINPROGRESS (Operation now in progress)
09:08:43.837016 poll([{fd=216, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000) = 1 ([{fd=216, revents=POLLOUT}])
09:08:43.837564 getsockopt(216, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
09:08:43.837621 fcntl(216, F_SETFL, O_RDWR) = 0
09:08:43.837714 sendto(216, "\0\0\0m\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0{\"se"..., 142, 0, NULL, 0) = 142
09:08:43.837888 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 217
09:08:43.837968 fcntl(217, F_GETFL) = 0x2 (flags O_RDWR)
09:08:43.838023 fcntl(217, F_SETFL, O_RDWR|O_NONBLOCK) = 0
09:08:43.838066 connect(217, {sa_family=AF_INET, sin_port=htons(2309), sin_addr=inet_addr("10.10.10.11")}, 16) = -1 EINPROGRESS (Operation now in progress)
09:08:43.838181 poll([{fd=217, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000) = 1 ([{fd=217, revents=POLLOUT}])
09:08:43.838547 getsockopt(217, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
09:08:43.838615 fcntl(217, F_SETFL, O_RDWR) = 0
09:08:43.838679 sendto(217, "\0\0\0m\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0{\"se"..., 142, 0, NULL, 0) = 142
09:08:43.838802 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 218
09:08:43.838886 fcntl(218, F_GETFL) = 0x2 (flags O_RDWR)
09:08:43.838950 fcntl(218, F_SETFL, O_RDWR|O_NONBLOCK) = 0
09:08:43.838998 connect(218, {sa_family=AF_INET, sin_port=htons(2308), sin_addr=inet_addr("10.10.10.11")}, 16) = -1 EINPROGRESS (Operation now in progress)
09:08:43.839080 poll([{fd=218, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000) = 1 ([{fd=218, revents=POLLOUT}])
09:08:43.839395 getsockopt(218, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
09:08:43.839497 fcntl(218, F_SETFL, O_RDWR) = 0
09:08:43.839589 sendto(218, "\0\0\0m\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0{\"se"..., 142, 0, NULL, 0) = 142
09:08:43.839759 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 219
09:08:43.839838 fcntl(219, F_GETFL) = 0x2 (flags O_RDWR)
09:08:43.839933 fcntl(219, F_SETFL, O_RDWR|O_NONBLOCK) = 0
09:08:43.839997 connect(219, {sa_family=AF_INET, sin_port=htons(2310), sin_addr=inet_addr("10.10.10.11")}, 16) = -1 EINPROGRESS (Operation now in progress)
09:08:43.840060 poll([{fd=219, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000) = 1 ([{fd=219, revents=POLLOUT}])
09:08:43.840359 getsockopt(219, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
09:08:43.840425 fcntl(219, F_SETFL, O_RDWR) = 0
09:08:43.840482 sendto(219, "\0\0\0m\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0{\"se"..., 142, 0, NULL, 0) = 142
09:08:43.840573 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 220
09:08:43.840640 fcntl(220, F_GETFL) = 0x2 (flags O_RDWR)
09:08:43.840706 fcntl(220, F_SETFL, O_RDWR|O_NONBLOCK) = 0
09:08:43.840800 connect(220, {sa_family=AF_INET, sin_port=htons(2311), sin_addr=inet_addr("10.10.10.11")}, 16) = -1 EINPROGRESS (Operation now in progress)
09:08:43.840904 poll([{fd=220, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 3000^Cstrace: Process 18682 detached
from gatewayworker.
It looks like a large number of interface calls caused the high load.
But I can not tell you which interface.
Reducing the call frequency can reduce the load.
from gatewayworker.
What is interface calls
exactly??
from gatewayworker.
For examples Gateway::sendToAll
Gateway::getAllClientSession
Gateway::....
etc.
from gatewayworker.
@walkor How can I reduce interface calls?? my load is really high
from gatewayworker.
Maybe some endless loop happened in the code logic that wasted all of the cpu resource,this situation can use gdb -p processId
to analyse it.
from gatewayworker.
@farwish I know that is is not infinitive loop . because CPU usage get down after a while
from gatewayworker.
Related Issues (20)
- Operation timeout in Lib\Gateway sendAndRecv method HOT 1
- Groups HOT 2
- 容器端口映射后,通过宿主机ip访问会出错,不兼容! HOT 1
- 版本约束问题
- swow驱动下CPU负载极高 HOT 1
- GatewayWorker 多进程长连接服务器会存在性能问题? HOT 2
- 4.x(dev-master) 版本存在内存溢出问题
- EventBase::loop(): Failed to invoke event callback, breaking the loop. HOT 9
- 计划3.x在何时发版 HOT 1
- 不支持PHP 8.x,提示过期的方法,是否升级支持PHP8.x? HOT 1
- 当用webman来使用GatewayWorker的时候的问题 HOT 5
- 在laravel的控制器中调用[ GatewayWorker\Lib\Gateway::getClientIdByUid]直接报错
- GatewayWorker最新的3.1.4版本必须使用workerman 5.0版本吗 HOT 1
- 有考虑什么时候更新到 workerman v5 版本吗?v4 版本不支持设置 proxy 信息
- Question - Send Message to particular business worker
- Round robin router for business worker
- Question :- Total number of connections per gateway and business worker HOT 5
- how to enable WEBSOCKET_EXTENSIONS: permessage-deflate And set server_max_window_bits HOT 2
- how do I know THE Connection would be closed by Server or Client itself? HOT 2
- ' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatewayworker.