-
Notifications
You must be signed in to change notification settings - Fork 453
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
Improve the EVA protocol: devos50 edition #6831
Conversation
7f0b801
to
033d2ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the changes in my experiment - seems to work great! 👍
757222f
to
b373f9e
Compare
@kozlovsky @devos50 what do you think guys about the latest refactoring (see the most resend commit)? UPD: we've discussed this refactoring with @kozlovsky and decided to rewrite it. |
5c08872
to
a12ce42
Compare
ea1591f
to
6492465
Compare
@devos50 changes are ready to test! 🚀 Please note that in the latest commit d6c09e3 EVA's interface has been slightly changed:
By a proxy method I mean: def eva_send_binary(self, peer: Peer, info: bytes, data: bytes, nonce: int = None) -> Future:
return self.eva_protocol.send_binary(peer, info, data, nonce) Here is an example of EVA usage: import os
from ipv8.community import Community
class MyCommunity(EVAProtocolMixin, Community):
community_id = os.urandom(20)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.eva_init()
self.eva.register_receive_callback(self.on_receive)
self.eva.register_send_complete_callback(self.on_send_complete)
self.eva.register_error_callback(self.on_error)
async def my_function(self, peer):
await self.eva.send_binary(peer, b'info1', b'data1')
await self.eva.send_binary(peer, b'info2', b'data2')
await self.eva.send_binary(peer, b'info3', b'data3')
async def on_receive(self, result):
self.logger.info(f'Data has been received: {result}')
async def on_send_complete(self, result):
self.logger.info(f'Transfer has been completed: {result}')
async def on_error(self, peer, exception):
self.logger.error(f'Error has been occurred: {exception}') |
5bfd9a8
to
d6c09e3
Compare
2094119
to
4e4f940
Compare
4e4f940
to
2125afe
Compare
Still haven't been able to test out the changes in an experiment setting - I hope to do so later this afternoon. |
@devos50 thank you in advance for testing! |
2125afe
to
aa31c60
Compare
a8c07e5
to
5540c4f
Compare
b52977e
to
99d1072
Compare
67ecaad
to
944cc7b
Compare
During the ultimate stress test of the EVA protocol made by @devos50 we figured out some improvements that could be done to the EVA protocol.
Packet loss
Problem
During massive use of binary transfers provided by EVA protocol, some packets seem to be dropped by a socket.
Solution
EVA protocol has been designed as an abstract protocol, that uses ipv8 as a transport layer. That means EVA doesn't care much about balancing socket load.
However, it seems like a good idea to add a tool to the protocol to have the ability to limit ipv8 and socket load.
This tool will be variable
max_simultaneous_transfers
and it will be set to10
by default.Missed messages resending for WriteRequest
Problem
EVA doesn't support handling lost WriteRequest packets and performs only one attempt to send WriteRequest.
Solution
@devos50 added this support in https://github.com/devos50/accountable-dfl/blob/main/accdfl/util/eva_protocol.py in a similar way as it was implemented for resend_acknowledge. I've merged his changes to this PR.
Future support for EVA protocol
@devos50 requested to add the
Future
object as a returned parameter to thesend_binary
function.See the example of use: https://github.com/devos50/accountable-dfl/blob/main/accdfl/core/community.py#L230
Shutdown method for EVA protocol
@devos50 requested to add this method because he has a necessity to fast shut down the entire EVA stack: