-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply without generating response #1266
Comments
👋 Thanks for opening this issue! Get help or engage by:
|
@m-mueller678 But why are using You can directly read from the state machine on the leader. Ensuring the leader state is possible via several methods, for example, subscribing to metrics which will tell you when the state changes. Alternatively, you can use Independent of that, not producing replies for state machine apply on the follower might be interesting. We do that indirectly, our reply type is |
I was not aware I could read from the state machine directly. How do I obtain a reference to the state machine from a |
You can use But, the implementation of |
Right, this new function has not been released.
This makes more sense, e.g., wrap your actual state machine in an |
Distinguishing between different response types (e.g.,
In short: |
When applying requests to the state machine, responses are always produced, even though they are only used on the leader as far as I can tell. In the project I am working on, there are many requests to the state machine that are read only, but are expensive to compute. On the followers, I would like to avoid this computation, as the response will be discarded anyway and the requests do not change the state machine.
I would like a variation of
RaftStateMachine::apply
that produces no response and is called whenever the response would be discarded anyway. It could defer to the normal apply implementation by default to not complicate implementingRaftStateMachine
:Alternatively, an extra parameter could be added to
apply
to control response generation, but that would put more burden on a minimal state machine implementation.A way for the leader to read directly from the state machine without writing a log would be preferred for my specific use case, but there could also be write-requests where the response is expensive to generate.
The text was updated successfully, but these errors were encountered: