n1ru4l/graphql-live-query

CPU and RAM going crazy with Socket.IO

Closed this issue · 2 comments

strblr commented

Hey @n1ru4l, hope you're doing well.

In one of my projects, we have an issue in production using this library, as the CPU sometimes spikes to 100% and the app is unusable. We put on a profiler, which shows the following:

pyroscope-flames

image_2023_05_24T21_28_47_857Z

Looks like Socket.IO is having some troubles.
There is the possibility that this is unrelated to this library of course, but in case you're familiar with this or have the slightest idea where it might come from, I'm curious to hear about it.
I'm going to try ws instead of Socket.IO tomorrow.

n1ru4l commented

Hmm, I think this is most likely an issue on the Socket.IO end. I have not encountered this, I am also not using this in a large-scale deployment.

strblr commented

Turns out the problem was a combination of using json diff and having massive payloads. I removed the diffing and reduced payloads in size, now it's smooth. I also switched from Socket.IO to ws but this didn't make a difference. I'm posting this in case someone runs in a similar situation.