Closed mbasij1 closed 2 years ago
The library offers many tools for optimization, but this is responsibility of the application.
IRaftCluster.ReplicateAsync
method.IRaftLogEntry
if you're not using Interpreter Framework. If Interpreter Framework is utilized, check serialization/deserialization performance inside of each command type implementing ISerializable<TSelf> interface.Full spectrum of optimization techniques greatly described here and here.
The correct picture of the performance include the measurements of each step of interaction:
Having that picture, you're able to perform correct decision about performance optimizations.
Release 4.2.0 includes many optimizations aimed to improve response time.
Replication of a single log entry of size 8 Kb takes ~10,7 ms for a single entry with the following settings
MemoryBasedStateMachine.Options.EvictionPolicy = LogEntryCacheEvictionPolicy.OnSnapshot
PersistentState.Options.WriteMode = WriteMode.AutoFlush
Replication of multiple log entries of size 8 Kb takes ~6,28 ms for a single entry with the settings mentioned above.
Disk write requires about 6 ms so I don't see any way to reduce it up to 1 ms.
For best performance, we use TcpConfiguration and create a simple k/v Store, that uses a simple dictionary. And not a configuration snapshot in PersistentState. we found that the optimistic way to create log entries is using fixed struct size like example. but I get 136ms avg latency that is very high for me. SqlServer instance give me 40ms avg latency for the same job! and we need 1-3ms avg latency. I wanna know we could reach 3ms with this library or should use other libraries?