-
Notifications
You must be signed in to change notification settings - Fork 109
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
Consider replacing TCP with UDP for internodal communication #81
Comments
It's a really good idea to replace TCP with UDP since the latter has lower overheads. In addition, two or more nodes behind NATs can talk each other using UDP hole-punching. From PR #92, it looks like we just need to implement |
Late for the party. I found some optimizations in the code that cause it to be unsafe to change to UDP. The first place is that the Candidate adds vote counts directly on receiving PySyncObj/pysyncobj/syncobj.py Lines 959 to 960 in 3ae622a
If changing to UDP, the sender of the The second place is that, when sending a big append entry, the msg is fragmented, and each fragment needs to be received in order and without loss and duplication. Otherwise PySyncObj/pysyncobj/syncobj.py Lines 1165 to 1186 in 3ae622a
If changing to UDP, the fragmented msgs should add sequence number and total size. And a retrying mechanism is need in case the packet is lost. |
As discussed in #4, it may be worth replacing TCP with UDP for a lower networking overhead.
The text was updated successfully, but these errors were encountered: