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 broadcasting message #1612

Open
Neylix opened this issue Nov 27, 2024 · 0 comments
Open

Optimize broadcasting message #1612

Neylix opened this issue Nov 27, 2024 · 0 comments
Labels
enhancements networking Involve networking P2P Involve P2P networking

Comments

@Neylix
Copy link
Member

Neylix commented Nov 27, 2024

Is your feature request related to a problem?

Currently there is only one function available to send a message to a node through Connection.send_message this function takes a timeout and expect the node to return a response.
But there is some messages that don't need any response and are often used using P2P.broadcast_message. This create useless network traffic and message handling as all messages return a response even if not handled by the client node.
Also as the send_message function is synchronous and wait the response, the function broadcast_message uses extra async task which could create bottle neck for the task supervisor

Describe the solution you'd like

We could create a new behavior for sending messages which do not require a response.
Connection module could have 2 functions:

  • request which has the same behavior as the actual send_message function
  • send_message a new function that just send the message to the node and directly return to the caller function

The new send_message function could also free some space in the Connection genserver as we do not need to store the request id and other stuff to handle the future response.

For the target node to distinguish the 2 behaviors, we could add a new boolean byte in the message envelop with true for sending the response, false to not send any reponse. This boolean could be handled by listener protocol to know the action to do after processing the message.

Additional context

No response

Epic

No response

@Neylix Neylix added enhancements networking Involve networking P2P Involve P2P networking labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancements networking Involve networking P2P Involve P2P networking
Projects
None yet
Development

No branches or pull requests

1 participant