-
Notifications
You must be signed in to change notification settings - Fork 476
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
Remove AOF commit blocking on State Invariant or Aof Independent Commands #511
base: main
Are you sure you want to change the base?
Remove AOF commit blocking on State Invariant or Aof Independent Commands #511
Conversation
@microsoft-github-policy-service agree company="Microsoft" |
2f5dbf1
to
f18ef82
Compare
195c7a5
to
14c5239
Compare
14c5239
to
53e4ca7
Compare
2d4bb63
to
0a755a4
Compare
…ndpeendent commands
0a755a4
to
c89bda1
Compare
b4838e4
to
c977ceb
Compare
405d2fe
to
ecf2862
Compare
a79f58a
to
b8de7eb
Compare
b8de7eb
to
f352ced
Compare
…ndpeendent commands
@@ -299,6 +312,9 @@ public override int TryConsumeMessages(byte* reqBuffer, int bytesReceived) | |||
} | |||
finally | |||
{ | |||
// reset the session's flag for AOF blocking to default value after processing all commands | |||
waitForAofBlocking = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inorder to make the session flag not be reset for the scenario where a single commands response may be batched over the network buffer, I made a slight change to Send method to pass context in case it is being called by the WriteDirectLarge method, but I moved the code as suggested
networkSender.GetResponseObject(); | ||
dcurr = networkSender.GetResponseObjectHead(); | ||
dend = networkSender.GetResponseObjectTail(); | ||
} | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
private void Send(byte* d) | ||
private void Send(byte* d, bool isChunked = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We call SendAndReset
in many places after partial command processing, and those are not caught by this code change. It seems it can be made correct by moving the setting to false of waitForAofBlocking, back to the finally in TryConsumeMessages
.
But unfortunately it is a bit conservative, because we might have 100 commands in the batch, the first command made waitForAofBlocking true and we finished esnding its result on network after blocking AOF flush, yet the bool will continue to stay true and block the AOF flush for all the remaining 99 commands even if they did not need to block.
This PR removes the need for commands of a certain type to wait for commits on the AOF log before sending response back to client.
The commands that qualify for no needing to be blocked on AOF are commands that are either:
These commands do not need to be blocked on WaitForCommit to complete if there are other RespServerSessions concurrently enqueueing commits to the shared AOF across the sessions.
RespParseStressTest Bench marking results left hand side is my branch, and right handside is main branch: