GatewayWorker icon indicating copy to clipboard operation
GatewayWorker copied to clipboard

Operation timeout in Lib\Gateway sendAndRecv method

Open Kulaxyz opened this issue 1 year ago • 1 comments

https://github.com/walkor/GatewayWorker/blob/aefdc21fdf847331a5acbd7e4422cd26d44e5474/src/Lib/Gateway.php#L1157

Under a high load workers turn to a busy state after this exception in sendAndRecv method

stream_socket_client(): unable to connect to tcp://127.0.0.1:2313 (Operation timed out) in GatewayWorker/Lib/Gateway.php on line 1157

Linux kernel is optimized based on a manual.

I believe the problem is that the connection is closed every time and needs to be open on each new message, because of a getSession method call

I also noticed that some other calls of stream_socket_client() have STREAM_CLIENT_PERSISTENT flag, but this one does not.

Is it possible to have long-lasting connections here, since it would dramatically increase a performance? If not, how can we prevent this timeout errors?

Kulaxyz avatar Dec 27 '22 02:12 Kulaxyz