starname.me

How to Understand RPC Batch Requests and Their Limits

An RPC batch request lets you send multiple independent requests to a node in a single HTTP call, and its main limit is that the node will process the entire batch or reject it entirely - with no guarantee about how many requests a given provider will accept per batch.

What an RPC batch request actually does

Standard JSON-RPC sends one request and receives one response. A batch request wraps an array of these requests into a single JSON array, sends them together, and receives an array of responses in the same order. The node processes each request independently, but it treats the whole batch as one unit for rate limiting and resource accounting.

The format looks like this:

[
 {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1},
 {"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":2},
 {"jsonrpc":"2.0","method":"eth_getBalance","params":["0x...","latest"],"id":3}
]

The response comes back as a parallel array:

[
 {"jsonrpc":"2.0","result":"0x...","id":1},
 {"jsonrpc":"2.0","result":"0x...","id":2},
 {"jsonrpc":"2.0","result":"0x...","id":3}
]

If any single request in the batch is malformed, some nodes will reject the entire batch. Others will return errors for the bad requests and results for the good ones. The JSON-RPC 2.0 specification allows either behavior, so you cannot assume one or the other.

Why providers impose batch limits

Public RPC providers like Infura, Alchemy, and QuickNode apply batch limits to protect their infrastructure. A single batch of 500 requests consumes roughly the same CPU and memory as 500 individual requests, but the connection overhead is lower. The limit exists because:

Typical batch limits you will encounter

There is no universal batch size limit. Each provider sets its own, and the limit can change without notice. Common patterns include:

The batch size limit is separate from the per-second rate limit. A provider might allow 100 requests per batch but only 10 batches per second. Check your provider's documentation or the error message you receive for the current figure.

What happens when you exceed the limit

If your batch exceeds the provider's limit, you will receive an HTTP 413 Payload Too Large error, a JSON-RPC error response, or the provider may silently drop the entire batch. The exact behavior depends on the provider and their load balancer configuration.

Some providers return a clear error message like "batch size exceeds limit". Others return a generic internal error. If your batch requests are failing with no obvious cause, test with a single request first, then gradually increase the batch size until you hit the failure point.

When batching helps and when it does not

Batching is useful when you need to read many independent pieces of data at the same logical time. Examples:

Batching does not help for dependent requests where the second call needs the result of the first. Each request in a batch is processed independently, so you cannot use the output of one request as the input to another within the same batch.

How to batch requests correctly

  1. Group requests by block tag: If you need data at block 100 and block 200, send separate batches for each block. Mixing block tags in one batch can give you inconsistent results if the node advances between processing requests.

  2. Keep batches under 50 as a safe default: Even if your provider allows 100, staying under 50 reduces the chance of hitting transient limits or memory issues.

  3. Use unique IDs: Each request in the batch must have a unique ID. Reusing IDs can cause unpredictable behavior when you try to match responses.

  4. Handle partial failures: Write your code to expect that some requests in a batch may return errors while others succeed. Do not assume the entire batch succeeded because the HTTP response code was 200.

  5. Test with your specific provider: Batch behavior differs between providers and even between endpoints on the same provider. Run a small test batch before relying on batching in production.

When to Run Your Own Node for Batching

If you need to send batches larger than what public providers allow, or if you need to send many batches per second, running your own node removes provider-imposed limits. A self-hosted Geth or Erigon node will accept batches of any size, limited only by your hardware. For heavy batch workloads, consider:

Your own node also gives you control over timeout settings and lets you tune the HTTP server for large payloads. The trade-off is the operational cost of keeping the node synced and healthy.

Not financial advice. starname.me publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.

Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.

Back to rpc & nodes