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

Make a peer.SendMarshalled function #3185

Open
Tracked by #3053
ValarDragon opened this issue Jun 4, 2024 · 1 comment
Open
Tracked by #3053

Make a peer.SendMarshalled function #3185

ValarDragon opened this issue Jun 4, 2024 · 1 comment
Labels
enhancement New feature or request p2p

Comments

@ValarDragon
Copy link
Collaborator

Feature Request

Summary

We spend a lot of time in peer.Send coming from broadcasting. There we have duplicated msg.Wrap and msg.Marshal methods (as we re-wrap/marshal for every peer). We should do that just once, and then send already marshalled bytes to each peer.

On further refactor, we should make block parts do the same thing. We spend latency-costly time, re-marshalling blockparts in the gossip routines, whereas we could just do it once.

Problem Definition

Lowers CPU times in broadcast routines, and on later refactors gossip routines.

Proposal

Introduce a peer.SendMarshalledData function. (Or alternatively edit the Envelope struct to allow optional marshalledMsg). Then make broadcast just marshal once.

@ValarDragon ValarDragon added enhancement New feature or request needs-triage This issue/PR has not yet been triaged by the team. labels Jun 4, 2024
@cason cason added p2p and removed needs-triage This issue/PR has not yet been triaged by the team. labels Jun 11, 2024
@cason
Copy link
Contributor

cason commented Jun 11, 2024

I assume you are mentioning the Brodcast method provided by the Switch, aren't you?

This was one of the multiple drawbacks introduced when the Send and TrySend methods were changed to receive proto messages instead of raw messages. We need a smarter solution for marshalling in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2p
Projects
None yet
Development

No branches or pull requests

2 participants