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

Server is going down #1049

Open
maybeshaed opened this issue Jan 9, 2024 · 2 comments
Open

Server is going down #1049

maybeshaed opened this issue Jan 9, 2024 · 2 comments

Comments

@maybeshaed
Copy link

Hello everyone, I ran into a problem using Ratchet as a websocket on a project. The project has clients in the form of users, as well as in the form of units with which users interact through the Central Server, all this communication is implemented using a websocket.

So, the problem: the server completely randomly starts to fall off (namely, the units with which users interact), the web socket lags and connecting to it via websocat takes 25+ seconds, which is a problem for units in getting a handshake with the server. Also, our database subsequently begins to be overloaded due to the large number of requests (I’m not sure that the websocket has anything to do with this, but rather my poor database setup). Also, one of the interesting phenomena is that after a drop, units begin to behave strangely, one drops, another connects, and so on in a circle, the only thing that helps us is rebooting the entire server, and even this does not always work, we have to reboot twice. When these problems are absent, if you reboot the machine, the units are connected back in a minute (about 100 units), and during the fall it doesn’t even take us 15 minutes to get everything back up. Below I attach a screenshot of what it looks like during the “fall”.
image
Thanks in advance everyone for the answers.

Info:
CentOS 7
php 7.4
mysql

@danilashtefan
Copy link

I have the very same issue in production. I am experiencing it for over 6 months. After some random amount of time server performance degradation is noticeable with exactly same description. After throughly verifying my DB setup and server parameters during this performance drop, I can confirm that the issue is in the web socket layer itself. Another noticeable fact is that it happens randomly, not even on the peal load.

I have found similar issues with people experiencing same. For instance #328. But there is not solution provided, just assumptions.

I really hope that contributors will react on this thread and give some advices. All these is making use of Ratchet really frustrating...

@newmediacrew
Copy link

Have you tried a simple service deamon. We are using this for years now and no issues whatever. This is running on unbuntu 22.04 lts

[Unit]
#service description
Description=The ratchet socket server
#start at level 3, after booting the network target
After=network.target

[Service]
Type=simple
#what do we want to start
ExecStart=/usr/bin/php /path/to/socketserver/SocketServer.php
TimeoutStartSec=0
#always restart on failure
Restart=always
#to avoid to much stress on the server only restart every 5 seconds
RestartSec=5

[Install]
WantedBy=multi-user.target

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

3 participants