Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

High CPU usage after a while #379

Closed
bbashy opened this issue May 19, 2020 · 14 comments
Closed

High CPU usage after a while #379

bbashy opened this issue May 19, 2020 · 14 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@bbashy
Copy link

bbashy commented May 19, 2020

63 Peak Connections
40 Websocket Messages
3 API Messages

Seen this happen few times. Websockets still work but it's maxing out at 99-100% CPU usage. I use port 2096 for Cloudflare proxy to pick it up. I use Supervisor to keep it running. I use release folders same as Laravel Envoyer.

Anyone seen or know why this might be?

@bbashy
Copy link
Author

bbashy commented May 28, 2020

Moved to a new dedicated server (from 4c/8t to 8c/16t) and it's still doing the same

@pl862008
Copy link

pl862008 commented Jun 5, 2020

I have the same problem, with laravel 7 and laravel-websockets - 1.4.0 - only two users testing
After 2-3 days, it stopped working and maxed one cpu, when dispatch the event - throws BroadcastExeption.

After killing the process, supervisor starts it again and works fine.

@rennokki rennokki added the help wanted Extra attention is needed label Aug 13, 2020
@dsteindl
Copy link

I run into the same problem on my server.
When having statistics enabled, the problem occures after a few minutes.
After I disabled statistics, the websocket server seemed to work, but unfortunately, the next day the websocket:server process showed up using 99-100% CPU again.

My server has 8 cores and each of them has 3.2GHz.

Our application is used by max. 500 people at the same time. And only a little section of our application joins websocket channels.
Currently there are only 50 people (max) joining websockets channels at the same time.

@rennokki
Copy link
Collaborator

2.x managed to somehow fix the issues related to performance. Make sure to check this PR and if you can (only if you can; it can cause breaks) you can upgrade to 2.0.0-beta.11 version of the package (or the latest at this point) to fix the CPU and Memory Leaks. 1.x does not have this fixed as 2.x is currently tested to deprecate 1.x

@rennokki rennokki added bug Something isn't working good first issue Good for newcomers and removed help wanted Extra attention is needed labels Aug 24, 2020
@bbashy
Copy link
Author

bbashy commented Aug 24, 2020

@rennokki Thanks for the work you've done to track it down. I'll see if I can update it to 2.x and report back.

@dsteindl
Copy link

@rennokki Thanks!
I updated to v2.0.0-beta.11 and started the websocket server about 3 hours ago.
Everything seems to work until now. The CPU load is between 0 and 3%

@rennokki
Copy link
Collaborator

Come back if the issues persist.

@rennokki
Copy link
Collaborator

rennokki commented Dec 1, 2020

So the issue was with Ignition package, please see laravel/framework#33952 (comment) for quick-fix and https://github.com/facade/ignition/issues/307 for the PR follow-up.

@bbashy
Copy link
Author

bbashy commented Dec 1, 2020

I published the flare config and set the maximum_number_of_collected_queries to 0. I'll report back.

I use composer install --no-dev on prod so not sure how the other PR mentioned in that thread will do.

@victornoleto
Copy link

I have the same problem, with laravel 7 and laravel-websockets - 1.4.0 - only two users testing After 2-3 days, it stopped working and maxed one cpu, when dispatch the event - throws BroadcastExeption.

After killing the process, supervisor starts it again and works fine.

Did you find a solution?

@bbashy
Copy link
Author

bbashy commented Nov 17, 2021

@victornoleto I think the solution is to update to v2 but it's still marked as beta.

I still get the issue, I just restart the process every now and then. It doesn't stop the functionality of the web socket.

@pwnz22
Copy link

pwnz22 commented Dec 29, 2021

I'm also having issues with that, using v2.0.0-beta.36 and laravel 8.40

@juristamrcl
Copy link

In case anyone having this issue, it seems I could figure it out upgrading to latest v1 (at the time of writing this comment 1.13). An issue also occured when running websockets daemon from non-existing folder (after few deployments the old ones have been removed and daemon continued to run from non-existing folder). I figured it out by running php artisan websockets:restart at the end of the deploy script.

@ILABUTK
Copy link

ILABUTK commented Oct 14, 2022

I am testing this config:

 "php": "^8.0.0",
 "beyondcode/laravel-websockets": "v2.0.0-beta.36",
 "doctrine/dbal": "^2.9", // required by websockets "v2.0.0-beta.36",

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

8 participants