Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

RPC server: investigate whether some RPC calls could benefit as blocking a.k.a tokio::spawn_blocking #11401

Open
niklasad1 opened this issue May 12, 2022 · 1 comment
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. Z3-substantial Can be fixed by an experienced coder with a working knowledge of the codebase.

Comments

@niklasad1
Copy link
Member

niklasad1 commented May 12, 2022

jsonrpsee supports three different types on calls sync, async and blocking

The methods has just been ported how they were defined via https://github.com/paritytech/jsonrpc so just sync or async but some RPC calls that are sync I/O such as reading DB might facilitate from using tokio::spawn_blocking instead of tokio::spawn which is used for the calls defined as async RPC calls.

See paritytech/jsonrpsee#486 for further information

@niklasad1 niklasad1 changed the title RPC server: inspect whether calls should be executed as blocking RPC server: inspect whether calls should be executed as blocking a.k.a tokio::spawn_blocking May 12, 2022
@niklasad1 niklasad1 changed the title RPC server: inspect whether calls should be executed as blocking a.k.a tokio::spawn_blocking RPC server: inspect whether some RPC calls should be executed as blocking a.k.a tokio::spawn_blocking May 12, 2022
@niklasad1 niklasad1 added Z3-substantial Can be fixed by an experienced coder with a working knowledge of the codebase. I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. labels May 12, 2022
@niklasad1 niklasad1 changed the title RPC server: inspect whether some RPC calls should be executed as blocking a.k.a tokio::spawn_blocking RPC server: investigate whether some RPC calls could benefit as blocking a.k.a tokio::spawn_blocking May 14, 2022
@niklasad1
Copy link
Member Author

So indeed, it looks like almost all state_calls should be blocking as those hasn't any awaits points and would mess with the scheduler, some of those calls are really slow and the public RPC nodes.

/cc @lexnv would be good to know if you could share your findings after investigating state_getKeys.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. Z3-substantial Can be fixed by an experienced coder with a working knowledge of the codebase.
Projects
None yet
Development

No branches or pull requests

1 participant