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

Optimize memory footprint of serde in RPC #577

Merged
merged 1 commit into from
Dec 1, 2021
Merged

Conversation

mssun
Copy link
Member

@mssun mssun commented Dec 1, 2021

Description

This PR optimize memory footprint of RPC (i.e., memory used by serde).

Serde uses up more than 10x memory to deserialize a json message when using #[serde(flatten)] and #[serde(tag = "request"].

In our case, we cannot handle more than 2M message because serde will allocation more than 100M bytes memory. The root cause is still unknown. With this PR, we can safely handle large requests in our services.

Note that this PR does not fix the Swift SDK accordingly. I'll fix it in later PRs.

Type of change (select or add applied and delete the others)

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

CI tests.

Checklist

  • Fork the repo and create your branch from master.
  • If you've added code that should be tested, add tests.
  • If you've changed APIs, update the documentation.
  • Ensure the tests pass (see CI results).
  • Make sure your code lints/format.

@mssun mssun requested a review from m4sterchain December 1, 2021 21:27
@mssun mssun merged commit edc10fd into apache:master Dec 1, 2021
@mssun mssun deleted the optimize-rpc branch December 1, 2021 23:03
@mssun mssun mentioned this pull request Dec 1, 2021
11 tasks
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.

2 participants