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

Possible CPU usage spikes #1528

Closed
timkendall opened this issue Aug 13, 2018 · 8 comments
Closed

Possible CPU usage spikes #1528

timkendall opened this issue Aug 13, 2018 · 8 comments

Comments

@timkendall
Copy link

timkendall commented Aug 13, 2018

Just upgraded our large GraphQL service to apollo-server-koa@2 and am seeing inconsistent CPU spikes all over the place. This seems to have caused inconsistent query response times (sometime queries are fast and sometimes they take many seconds).

Haven't had a chance to dig in yet but figured it was worth reporting now. Worth noting that we rely heavily on remote schema stitching.

Mega Spikes:

image

@timkendall
Copy link
Author

@artboard-studio
Copy link

Unfortunately Graphql.js 14.0.0 has not fixed it yet, we are experiencing multiple crashes every couple of hours, and to this day we have not been able to find the source of the issue, no errors, no warnings, just the CPU spikes up, causes a domino effect in all of our ECS instances, 5 minutes later, everything goes back to normal, until the next series of crashes. Completely giving up on anything Node.js related.

@timkendall
Copy link
Author

Ugh thats gnarly. @Human-a what version of node are you guys on (we're on v10.9.0)?

@artboard-studio
Copy link

@timkendall Yes, it surely is gnarly. We are on v8.12.0
I have also contacted AWS support (we have the business support plan) and they are looking into the issue to find the source of the issue. I will reply back here if they give me something useful, you may find it useful too.

@ZhimaoL
Copy link

ZhimaoL commented Nov 21, 2018

I am wondering have u guys solved the CPU problems? I tried to run apollo server as API gateway (simple logic in apollo server) on kubernetes, and experienced a very high CPU usage. Especially the socket connections with redis pubsub, the CPU will reach 1.5 core quickly. Do you guys have any related experiences? @Human-a @timbotnik

@artboard-studio
Copy link

@ZhimaoL In our case, the issue was not related to GraphQL, it was caused by another library we were using, which was causing infinite loops, and because NodeJS is rather dumb, we could not see any errors or warnings. All I did was to use the library on the client side, and bam, there was the error on our console.

The library that was causing the issue: https://github.com/TinyNova/deep-omit-by
We fixed the infinite loop it by doing so JSON.parse(JSON.stringify(ourObject))

I hope this helps. I would suggest looking elsewhere for the source of your CPU spikes first.

@AndryKwiatow
Copy link

Hi, guys. Do you have any update in this? I'm experiencing the same in my EC2 instance

@glasser
Copy link
Member

glasser commented Apr 8, 2021

There is not enough information here to usefully investigate. (For example, at least one of the cases above was "a user had an infinite loop in their code".)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants