I work on a system that offers an API over JSON RPC using this library. A couple of folks were advocating for advanced batching in our client library. Turns out what they were trying to solve was fundamentally a performance problem. This is when I discovered that our RPC nodes are running in HTTP/1.1 mode.
Problem
Because the RPC operates in HTTP/1.1 mode it's unable to pipeline more than 6 requests at a time.
When you make more than 6 RPC requests in parallel, the browser produces this nightmare of a waterfall, where each request has to wait on a CORS preflight in batches of 6, and then resolve the data in batches of 6. This imposes a massive delay on getting your answer, and is making our apps many times slower and less responsive than they could be.
If you put a proxy in front of paritytech/jsonrpc that supports HTTP/3 it yields parallel request resolution like this.
Particularly relevant for CLI tools - browsers will follow whatever the proxy/frontend provides in terms of hints but on the CLI Node seems to always use HTTP/1.1 unless HTTP/2 is specifically implemented.
Background
I work on a system that offers an API over JSON RPC using this library. A couple of folks were advocating for advanced batching in our client library. Turns out what they were trying to solve was fundamentally a performance problem. This is when I discovered that our RPC nodes are running in HTTP/1.1 mode.
Problem
Because the RPC operates in HTTP/1.1 mode it's unable to pipeline more than 6 requests at a time.
When you make more than 6 RPC requests in parallel, the browser produces this nightmare of a waterfall, where each request has to wait on a CORS preflight in batches of 6, and then resolve the data in batches of 6. This imposes a massive delay on getting your answer, and is making our apps many times slower and less responsive than they could be.
If you put a proxy in front of paritytech/jsonrpc that supports HTTP/3 it yields parallel request resolution like this.
Playground: https://codesandbox.io/s/sweet-surf-qu60i3?file=/src/index.js
Proposed Solution