Remove unnecessary mutexes in RPC server #646
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes unnecessary synchronization code:
rpc::Server
startup/shutdown andSuch a refactoring is possible because the BackEndKV server threading model changed since the synchronization introduction at the beginning of the implementation.
Specifically, each
rpc::ServerContext
now executes on its own threaded scheduler powered byasio::io_context
, as opposed to a couple of threads per context in the first implementation. This simplifies the shutdown sequence which can be now started by theasio::io_context
intercepting the termination signals and carried on by eachrpc::ServerContext
for its data structures (namely,grpc::CompletionQueue
objects).