Code Monkey home page Code Monkey logo

Comments (3)

freeekanayaka avatar freeekanayaka commented on July 22, 2024

You can deliver whole messages in any order, yes, and this implementation will be just fine with that. However if you simply swap TCP with UDP using the default implementation of the raft_io interface, then you might get partial messages (or any sort of byte rearrangement of the message stream), and that won't work. You'd need to implement your own version of the raft_io interface that is able to tolerate UDP re-arrangements and still deliver whole messages to the core engine (possibly out of order). See also raft.h for the definition of the raft_io interface.

Hope that helps.

from raft.

tathougies avatar tathougies commented on July 22, 2024

I suppose my follow up would be if there's a maximum size for the datagram. I would imagine if it's below the link MTU then we wouldn't need to worry about re-arrangement. On the other hand, TCP probably works fine.

from raft.

freeekanayaka avatar freeekanayaka commented on July 22, 2024

I suppose my follow up would be if there's a maximum size for the datagram. I would imagine if it's below the link MTU then we wouldn't need to worry about re-arrangement. On the other hand, TCP probably works fine.

We wouldn't need to worry about partial messages, correct. But the raft library can't make such a guarantee because the size of (say) AppendEntries messages basically depend on the user's payload.

Note that there's been anecdotal evidence that UDP doesn't make the Raft algorithm any faster in practice. Plus you'll very likely need to re-invent some part of TCP in your UDP-based implementation (e.g. flow control).

from raft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.