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

Perf/read rpc message to end #6951

Merged
merged 8 commits into from
May 3, 2024
Merged

Conversation

LukaszRozmej
Copy link
Member

@LukaszRozmej LukaszRozmej commented Apr 26, 2024

Changes

  • Reads JSON RPC message to end before trying to deserialize it.
  • Helps with performance on very long requests (which are fairly rare and less realistic scenarios)

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Would be worth comparing performance on very many batched requests (as many as you can under 30MB request limit) as it might be better or worse than original.

@marcindsobczak Would be worth comparing NewPayload performance with big but reasonable size blocks.

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

Comment on lines 140 to 142
ReadResult readResult = _jsonRpcConfig.MaxRequestBodySize is not null
? await reader.ReadAtLeastAsync((int)_jsonRpcConfig.MaxRequestBodySize.Value)
: await reader.ReadToEndAsync();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm torn about this one, @benaadams ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am wondering about adding a timeout also?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vs a very slow request; like if the full request takes more than 1sec to receive chop it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some global timeouts on json rpc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will think about it a bit more.

@LukaszRozmej LukaszRozmej merged commit f469f94 into master May 3, 2024
67 checks passed
@LukaszRozmej LukaszRozmej deleted the perf/read-rpc-message-to-end branch May 3, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants