Skip to content

Improve handling of concurrent requests in WebSocketGraphQlClient #388

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
rstoyanchev opened this issue May 11, 2022 · 5 comments
Closed
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

Attempts to send requests concurrently may fail with:

java.lang.IllegalStateException: Failed to send request: FAIL_NON_SERIALIZED

This is because we are using the Reactor Sinks API which expect serial sending with external synchronization. The current implementation however simply retries 100 times and fails if it keeps losing out.

This needs to be improved and was also reported in #369 (comment).

@viral-kondhia
Copy link

viral-kondhia commented May 11, 2022

I just wonder why it does not happen with HttpGraphQLClient
Please excuse me as I don't have understanding about the sinks API.

@rstoyanchev
Copy link
Contributor Author

GraphQL over WebSocket uses a single, shared connection for all requests. GraphQL over HTTP on the other hand makes an independent HTTP request for each GraphQL request and underlying that is a connection pool. So WebSocket is more efficient but is also a little more challenging to implement.

@rstoyanchev
Copy link
Contributor Author

@viral-kondhia this should be fixed now. If you would like to give it a try with 1.0.0-SNAPSHOT and confirm it works for you, that would be great.

@viral-kondhia
Copy link

@rstoyanchev Yes I think it's fixed
I did maven update and then restarted my service and tested 40 request per second with same socket graphql client..

@rstoyanchev
Copy link
Contributor Author

Thanks for trying the snapshots and confirming!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants