graphql-engine
graphql-engine copied to clipboard
High CPU when using WS client in Kotlin
Version Information
Server Version: CLI Version (for CLI related issue): v2.10.1.cli-migrations-v3
Environment
OSS
What is the current behaviour?
Per the repro demonstration in this linked repository, enabling the useGraphQLWsProtocol
option in the Apollo client creation code results in a very significant uptake in CPU usage.
After running the repro and monitoring the network traffic, it appears that the issue is related to the ping/pong messaging involved in the GraphQLWsProtocol. Per the attached PCAP
files, the pings
appear to originate from the server side, such that configuration changes to the client do not seem to have an impact (i.e., adding a high value to the pingIntervalMillis
on the GraphQLWsProtocol.Factory
appeared to have no effect).
What is the expected behaviour?
CPU usage should not rise significantly when using the GraphQLWsProtocol.
How to reproduce the issue?
Please see the repo indicated above.
Please provide any traces or logs that could help here.
Please see the attached PCAP
files (note: the server was running on port 7070, per the repro).
PCAP_files.zip
Any possible solutions?
One option might be to significantly reduce the ping interval initiated by the server.
Keywords
Websocket CPU Ping
Hi @gneeri , thanks for opening this issue. We have been able to identify the root cause of this issue.
The server is responding with ping
for every pong
from the client if the pong
payload is empty (doesn't contain the earlier server ping
information). This is resulting in continuous ping
pongs
between server and the client. The fix is that server should not send a ping
which stops this loop.
This will be resolved in the next release which is 2.13.0-beta.1 (due this week). Here is the commit that fixes this.
This has been addressed in release v2.13. Closing this issue. Please re-open if the issue persists. Thanks.