I'm currently trying to create a simple interface for the consensus algorithm in .

The plan is to provide traits for a Transport, Machine, and Storage which can be passed to a Node instance which then manages the state of the machine over the transport on the storage.

Further crates will later provide implementations for e.g. a TCPTransport or a HashMapMachine.

The project can be found on github:

But don't expect too much yet, it's still WIP... 😉 🦀

Today I worked on a new Machine trait for my raft Node. The new trait introduces the possibility to store and read state from the machine.

This was previously only possible through the node itself and very unhandy. The machine can now be accessed on the same thread where the node was created.

I was able to do this without using any locks (Mutex, etc.). All inter-thread communication is done with channels so far.

However, the implementation is currently very slow. All operations on the machine are blocking for now and lead to the whole cluster processing only one state change per tick (100ms).

This can be changed by introducing an asynchronous API, which will be implemented later.

I added async support for the machine implementation. I am using the new async/await syntax from nightly and it looks very good so far. The rustasync/runtime executor works like a charm!

I have also added support for the machine trait to support building a machine from a storage snapshot and entries. However, I am not quite happy with the type constraints on my machine. It feels like a hack and will probably cause problems in the future!

The overall performance is now a lot better. However, writes are still quite slow, although I managed to track the problem down to the raft-rs implementation.

Additionally, the raft cluster is crashing and getting very slow when doing many state-change proposals at once.

I think it is now time to look again into properly implementing the ready state processing. Currently it is quite hacky and likely the source of all my raft related problems :D

You can follow development on github: github.com/fin-ger/simple-raft

The project runs on rust-nightly only.

I continued development of my raft-node implementation in and finally finished introducing TCP transports!

However, the implementation still contains some hacks and is definitely unstable.

A working TCP transport can be found under examples/tcp.rs on github:

I will create a more complex example now that will include a chart for easy deployment!

After finishing my raft-node prototype I will move on scratching up a distributed router based on that raft-node.

The router will support only publish/subscribe for now. The complete core profile will be eventually implemented when vertical prototyping is finished.

Also, the projects involved into this prototyping lack all kinds of documentation. Documenting and cleaning up the code base of all these projects will be number one priority after prototyping the WAMP-router.

I created an example () deployment of a distributed key-value store based on my simple-raft-node library. I finally got a first POC running!!! 😎


· · Web · 0 · 0 · 0
Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!