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

Offloading JSON serialization for huge payloads #486

Closed
crystalin opened this issue Sep 24, 2021 · 2 comments · Fixed by #523
Closed

Offloading JSON serialization for huge payloads #486

crystalin opened this issue Sep 24, 2021 · 2 comments · Fixed by #523

Comments

@crystalin
Copy link

As mentioned in paritytech/substrate#9458, there are cases where the response can be quite huge (for tracing requests) and would lock the rpc thread by calling the json formatter.

A possibility is to offload the serialization into a separate thread. This might add additional cost for small payload so benchmarking it would probably be a good idea before doing the switch.

@maciejhirsz
Copy link
Contributor

@crystalin #523 will allow you to register a blocking method, which executes in entirety (including JSON serialization) to a dedicated thread. Would that solve this for you?

Note: This is only enabled for synchronous methods, there is a way to make it work with async methods, but it requires jumping through some hoops and is potentially a footgun if at any point in the async workflow one tries to interact with the main async tokio reactor (read: it would panic in that scenario).

@crystalin
Copy link
Author

I believe it would solve it yes, as the case where the thread.
Also curious, is the thread handling the query also the thread that must handle the response (Like it is on the RPC module used by Substrate) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants