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

pd: save work streaming compact blocks by avoiding needless deserialization #4008

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

hdevalence
Copy link
Member

Describe your changes

This pulls a proto type out of the state and passes it to the RPC directly, rather than deserializing through a domain type (which involves another round of allocations and some crypto operations to parse field elements). This should help reduce load for RPC servers streaming compact blocks to clients.

We could in principle go further and pull bytes directly out of the state and pass them directly to the client (avoiding the bytes>proto>bytes conversion) but that would be more work (I'm not sure exactly how or if Tonic supports that), and this is lower-hanging fruit.

Issue ticket number and link

No issue, just an observation after I looked at Grafana and took a few minutes to change

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    This only changes the RPC implementation, not any consensus logic; it should be safe to cherry-pick and deploy on a release branch.

…ation

This pulls a proto type out of the state and passes it to the RPC directly,
rather than deserializing through a domain type (which involves another round
of allocations and some crypto operations to parse field elements). This should
help reduce load for RPC servers streaming compact blocks to clients.

We could in principle go further and pull bytes directly out of the state and
pass them directly to the client (avoiding the bytes>proto>bytes conversion)
but that would be more work (I'm not sure exactly how or if Tonic supports
that), and this is lower-hanging fruit.
@hdevalence
Copy link
Member Author

Looks like my changes in #3993 broke the PR template (cc @aubrika)

@erwanor erwanor merged commit 3a9db32 into main Mar 12, 2024
6 checks passed
@erwanor erwanor deleted the compactblock-stream-proto branch March 12, 2024 21:18
conorsch pushed a commit that referenced this pull request Mar 13, 2024
…zation (#4008)

## Describe your changes

This pulls a proto type out of the state and passes it to the RPC
directly, rather than deserializing through a domain type (which
involves another round of allocations and some crypto operations to
parse field elements). This should help reduce load for RPC servers
streaming compact blocks to clients.

We could in principle go further and pull bytes directly out of the
state and pass them directly to the client (avoiding the
bytes>proto>bytes conversion) but that would be more work (I'm not sure
exactly how or if Tonic supports that), and this is lower-hanging fruit.

## Issue ticket number and link

No issue, just an observation after I looked at Grafana and took a few
minutes to change

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

> This only changes the RPC implementation, not any consensus logic; it
should be safe to cherry-pick and deploy on a release branch.

(cherry picked from commit 3a9db32)
conorsch pushed a commit that referenced this pull request Mar 13, 2024
…zation (#4008)

## Describe your changes

This pulls a proto type out of the state and passes it to the RPC
directly, rather than deserializing through a domain type (which
involves another round of allocations and some crypto operations to
parse field elements). This should help reduce load for RPC servers
streaming compact blocks to clients.

We could in principle go further and pull bytes directly out of the
state and pass them directly to the client (avoiding the
bytes>proto>bytes conversion) but that would be more work (I'm not sure
exactly how or if Tonic supports that), and this is lower-hanging fruit.

## Issue ticket number and link

No issue, just an observation after I looked at Grafana and took a few
minutes to change

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

> This only changes the RPC implementation, not any consensus logic; it
should be safe to cherry-pick and deploy on a release branch.

(cherry picked from commit 3a9db32)
conorsch pushed a commit that referenced this pull request Mar 13, 2024
…zation (#4008)

## Describe your changes

This pulls a proto type out of the state and passes it to the RPC
directly, rather than deserializing through a domain type (which
involves another round of allocations and some crypto operations to
parse field elements). This should help reduce load for RPC servers
streaming compact blocks to clients.

We could in principle go further and pull bytes directly out of the
state and pass them directly to the client (avoiding the
bytes>proto>bytes conversion) but that would be more work (I'm not sure
exactly how or if Tonic supports that), and this is lower-hanging fruit.

## Issue ticket number and link

No issue, just an observation after I looked at Grafana and took a few
minutes to change

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

> This only changes the RPC implementation, not any consensus logic; it
should be safe to cherry-pick and deploy on a release branch.

(cherry picked from commit 3a9db32)
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