Giter Club home page Giter Club logo

Comments (9)

schreter avatar schreter commented on September 24, 2024 3

So this is the partial success reply? send_append_entries() has to be able to return what log entries are replicated and what not, instead of a single bool.

There are two parts to this:

  • timeout handling for large batches
  • partial success reporting

For the former, it's sufficient to pass TTL into the method instead of timeouting on the outside. The Network implementation can then apply the timeout to individual messages/sub-batches.

The latter is the possibility to advance commit index before the entire batch is processed. Here, the Network implementation might return early, indicating Success(LogIndex) instead of plain Success, so the caller can adjust the commit index and do the needful before diving back to Network with remaining entries to process.

Alternatively, it could be possible to completely decouple it (streaming API), so the Network would send back the status via a callback batch-wise, similar to the updates done to the logging already. I.e., there would be no big difference between local logging and log replication. Potentially, even the same callback type could be used.

from openraft.

Licenser avatar Licenser commented on September 24, 2024 1

I think this would be a really neat feature that improves network reliability and would work well hand in hand with unreachable state or even initial joins.

One thing we've been doing in tremor is using dynamic backpressure from the downstream system to throttle messages (either drop which isn't reasonable here, or slow down sending which might work well).

Perhaps a similar logic could be added here? I think with a timeout hint it could even be done inside the Network implementation and not force openraft to make a decision, a downstream system could send back a "please slow don" message that the network protocol implements, and then the sender goes and increases timeouts or adds delays as required.

from openraft.

schreter avatar schreter commented on September 24, 2024 1

I think with a timeout hint it could even be done inside the Network implementation and not force openraft to make a decision

Exactly, this was the intention :-).

from openraft.

Licenser avatar Licenser commented on September 24, 2024 1

Many messaging systems use always increasing message IDs and sparse akcs to allow for batching (in this fashion) without needing to have full batches to be confirmed. I think we can "steal" the idea here. The basic idea is not every message has to be acknowledged but any acknowledgement given means this and everything before was received and processed. I think that would satisfied @schreter's requirement and be quite scalable as we still have 1 ack / batch in most cases even during partial acks

from openraft.

drmingdrmer avatar drmingdrmer commented on September 24, 2024 1

Certainly! At the moment, openraft follows a request/response design. Implementing a streaming pattern as you proposed would bring about increased flexibility and efficiency.

I have been focusing on refactoring the storage API to a stream-like interface, after which the network API will be revised accordingly.

from openraft.

Licenser avatar Licenser commented on September 24, 2024 1

Ja no hurry, I'm just thinking out loud :)

from openraft.

github-actions avatar github-actions commented on September 24, 2024

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

from openraft.

drmingdrmer avatar drmingdrmer commented on September 24, 2024

@schreter :

I think @Licenser 's requirement is to stop sending out anything if a node is known to be unreachable(send_append_entries() returns Unreachable), and the case you mentioned is another problem(send_append_entries() returns NetworkError).

Pass in a ttl to send_append_entries() would be great!

And with current framework, openraft can not deal with a partial successful result, and it will always resend the full bulk of entries again.

For now, maybe it is feasible to let the network implementation return a timeout hint back to openraft therefore the next time openraft will use a bigger timeout.

I think you were talking about a stream like send-entries API, with which the a big bulk of entries is split into small chunks.
Let me add it when the storage v2 refactoring is done.

from openraft.

drmingdrmer avatar drmingdrmer commented on September 24, 2024

I think with a timeout hint it could even be done inside the Network implementation and not force openraft to make a decision

Exactly, this was the intention :-).

So this is the partial success reply? send_append_entries() has to be able to return what log entries are replicated and what not, instead of a single bool.

from openraft.

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.