Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operation timeout in Lib\Gateway sendAndRecv method #100

Open
Kulaxyz opened this issue Dec 27, 2022 · 1 comment
Open

Operation timeout in Lib\Gateway sendAndRecv method #100

Kulaxyz opened this issue Dec 27, 2022 · 1 comment

Comments

@Kulaxyz
Copy link

Kulaxyz commented Dec 27, 2022

$client = stream_socket_client("tcp://$address", $errno, $errmsg, static::$connectTimeout);

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?

walkor added a commit that referenced this issue Dec 31, 2022
@walkor
Copy link
Owner

walkor commented Dec 31, 2022

Please update file https://github.com/walkor/GatewayWorker/blob/master/src/Lib/Gateway.php which use persistent connections for Gateways and workers communication. If that works for you I will release a new version later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants