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

Use fixed max senders/receivers due to 10MB limit for max_response_body_size #19

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

Dengjianping
Copy link
Collaborator

@Dengjianping Dengjianping commented Nov 6, 2022

Signed-off-by: Dengjianping djptux@gmail.com

Currently, there's a limit on the max_response_body_size, which is 10MB(10485760 bytes).
So by calculation, 10MB means

let (max_senders, max_receivers) = (1024 * 16, 1024 * 16);

Before serialization, the data in memory is about 3.39MB.
But after serialization, it will become 9.88MB, almost 10MB.

So if any number exceeds 1024 * 16, the server will return an error like this

The background task been terminated because: Networking or low-level protocol error: WebSocket connection error: 
message too large: len >= 12951047, maximum = 10485760; restart required

Take a look at this PR: paritytech/jsonrpsee#711
and https://github.com/paritytech/jsonrpsee/blob/v0.15.1/core/src/lib.rs#L81

So we have to use fixed values for (max_senders, max_receivers).

jsonrpsee is using serde for serialization/deserialization, seems there's no way to change to another crate like codec for more compacted data.

…dy_size

Signed-off-by: Dengjianping <djptux@gmail.com>
@flame4
Copy link
Contributor

flame4 commented Nov 6, 2022

LGTM!

@Dengjianping Dengjianping merged commit 1fc0efa into main Nov 8, 2022
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 this pull request may close these issues.

None yet

2 participants