Skip to content

RPC: add JSON-RPC batch request support - #694

Draft
redsh4de wants to merge 2 commits into
Cuprate:mainfrom
redsh4de:feat/jsonrpc-batch-req
Draft

redsh4de wants to merge 2 commits into
Cuprate:mainfrom
redsh4de:feat/jsonrpc-batch-req

Conversation

@redsh4de

Copy link
Copy Markdown
Contributor

What

Add JSON-RPC 2.0 batch request support

Depends on #692

Why

Compliance with the spec, more efficient if you know you need to request several items at once

Where

cuprated, rpc

How

  • /json_rpc takes raw Bytes instead of axum's Json; a body starting with [ is a batch, everything else is the existing single-request path. The Content-Type check Json did implicitly is now manual. This was done to improve batch performance
  • A handrolled json content type checker was added so we don't have to depend on mime
  • Entries are held as RawValue and parsed individually, so one bad entry only fails itself. Notifications are left out of the response array. An empty batch is not accepted
  • Entries run concurrently via FuturesUnordered, capped by a new RpcHandler::batch_concurrency(). Responses come back in completion order, matched by id
  • Docs: architecture book + both RPC READMEs

@github-actions github-actions Bot added A-dependency Area: Related to dependencies, or changes to a Cargo.{toml,lock} file. A-docs Area: Related to documentation. A-rpc Area: Related to RPC. A-books Area: Related to Cuprate's books. A-binaries Area: Related to binaries. A-book-architecture Area: Related to the Architecture book. labels Aug 26, 2026
@redsh4de
redsh4de force-pushed the feat/jsonrpc-batch-req branch from 224911d to 97e9d06 Compare August 26, 2026 19:49
@redsh4de
redsh4de force-pushed the feat/jsonrpc-batch-req branch from 97e9d06 to c1ed475 Compare August 27, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-binaries Area: Related to binaries. A-book-architecture Area: Related to the Architecture book. A-books Area: Related to Cuprate's books. A-dependency Area: Related to dependencies, or changes to a Cargo.{toml,lock} file. A-docs Area: Related to documentation. A-rpc Area: Related to RPC.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant