-
Notifications
You must be signed in to change notification settings - Fork 907
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified the logic for ForceWriteThread after we introduced queue.d…
…rainTo() (#3830) ### Motivation In #3545 we have switched the `ForceWriteThread` to take advantage o `BlockingQueue.drainTo()` method for reducing contention, though the core logic of the force-write was not touched at the time. The logic of force-write is quite complicated because it tries to group multiple force-write requests in the queue by sending a new marker and grouping them when the marker is received. This also leads to a bit of lag when there are many requests coming in and the IO is stressed, as we're waiting a bit more before issuing the fsync. Instead, with the `drainTo()` approach we can greatly simplify the logic and maintain a strict fsync grouping: 1. drain all the force-write-requests available in the queue into a local array list 2. perform the fsync 3. update the journal log mark to the position of the last fw request 4. trigger send-responses for all the requests 5. go back to read from the queue This refactoring will also enable further improvements, to optimize how the send responses are prepared, since we have now a list of responses ready to send.
- Loading branch information
Showing
4 changed files
with
45 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.