Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Optimistic State Machine Execution

36 views
Skip to first unread message

milan...@axoniq.io

unread,
Oct 1, 2024, 9:59:50 AM10/1/24
to raft-dev
Hi all!

I stumbled upon a talk at the Systems Distributed conference. I was explicitly triggered by the Optimistic State Machine Execution part of the talk and wanted to pick your brains on the topic.

The main point is to apply the log entry even while it is being committed. If something happens during the commit, you can "just" roll back the application process. Or you can wait to update the apply index until the entry is committed AND applied, so you don't need to do any rollback. Of course, the state machine must be idempotent, but that must be the case anyway.

It seems feasible. It could significantly improve the performance of the time-consuming state machines. Does anyone see an issue with this approach?

I appreciate any feedback on the topic.

Cheers,
Milan

Andy Schwerin

unread,
Oct 1, 2024, 10:38:19 AM10/1/24
to raft...@googlegroups.com
MongoDB replica sets optimistically apply the log (which in mongodb is called the oplog). In MongoDB, the advantage is not so much that it is time-consuming to apply the state machine changes (though it can be). Rather the advantage is that it allows back-to-back dependent operations to be pipelined and it allows concurrent writes to individual documents from separate clients to be pipelined (later operations can execute based on the state of earlier ones that are still replicating).

MongoDB leverages machinery in the WiredTiger storage engine to preserve snapshots of the database that _are_ durably replicated, to facilitate rollback, but it is still a heavy process compared to an individual write. As such, it is really only useful when elections are infrequent in practice. Throughput definitely drops a lot when elections and rollbacks are frequent, and so in those situations it would probably be wise to apply operations pessimistically.

-Andy

--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/raft-dev/1a494311-7dec-4bc6-be10-d8a86138ea36n%40googlegroups.com.
Message has been deleted

milan...@axoniq.io

unread,
Oct 1, 2024, 12:50:06 PM10/1/24
to raft-dev
That makes sense. Pipelining is a significant benefit! Thanks, Andy!

M.

Reply all
Reply to author
Forward
0 new messages