-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow YBClient callback(s) to run in a separate threadpool
Summary: We have this feature already for CQL side of things, where the callback from FlushAsync gets scheduled to run in a handler thread instead of running in the reactor thread. But, Redis was missing that feature. Allow YBClient to have a separate threadpool for running callbacks. This should address the "blocked reactor for xxx issue". Test Plan: Jenkins for tests. Push to cluster and see a reduction in "blocked reactor for xxx sec" Seems to reduce the blocked reactor for xxx messages. However, they are not completely eliminated. We only offload the callback portion to the other threads. If for some reason we take longer in a different stage, for example log trace, or waiting for a lock to update flush state, we might still run into this. They are far fewer though. I0327 18:18:52.537797 17690 connection.cc:339] Connection (0x2305a850) server 127.0.0.1:37384 => 127.0.0.1:6379 recv error: Network error (yb/util/net/socket.cc:575): recvmsg error: Connection reset by peer (error 104) W0327 18:19:00.353492 17815 outbound_call.cc:342] RPC callback for RPC call yb.tserver.TabletServerService.Read -> { remote: 0.0.0.0:0 idx: 0 } , state=FINISHED_SUCCESS. blocked reactor thread for 50897.8us. Trace: : 0327 18:19:00.120859 (+ 0us) outbound_call.cc:184] Outbound Call initiated. 0327 18:19:00.120926 (+ 67us) outbound_call.cc:390] Queued. 0327 18:19:00.120935 (+ 9us) outbound_call.cc:401] Call Sent. 0327 18:19:00.302372 (+181437us) async_rpc.cc:132] AsyncRpc::Finished Begin 0327 18:19:00.302420 (+ 48us) async_rpc.cc:135] AsyncRpc::Finished Done with Done() new_status = OK 0327 18:19:00.302813 (+ 393us) async_rpc.cc:137] AsyncRpc::Finished ProcessedResponseFromTserver 0327 18:19:00.303020 (+ 207us) async_rpc.cc:139] see line 0327 18:19:00.303024 (+ 4us) batcher.cc:171] CheckForFinishedFlush 0327 18:19:00.303033 (+ 9us) batcher.cc:181] Updated state 0327 18:19:00.352620 (+ 49587us) batcher.cc:188] Set FlushFinished 0327 18:19:00.352639 (+ 19us) batcher.cc:205] submitting flush_callback_ 0327 18:19:00.352734 (+ 95us) batcher.cc:220] submitted flush_callback_ 0327 18:19:00.352738 (+ 4us) async_rpc.cc:141] see line 0327 18:19:00.353239 (+ 501us) async_rpc.cc:144] AsyncRpc::Finished All done 0327 18:19:00.353246 (+ 7us) outbound_call.cc:328] Done calling 0327 18:19:00.353251 (+ 5us) outbound_call.cc:334] Done freeing 0327 18:19:00.353270 (+ 19us) trace.cc:320] Dumping to list Related trace: Also, if we happen to run through the callback in the threadpool before the reactor thread finishes, the reactor thread might again become responsible for cleaning up the data structures. possibly taking long. W0327 18:20:45.847632 17815 outbound_call.cc:342] RPC callback for RPC call yb.tserver.TabletServerService.Read -> { remote: 0.0.0.0:0 idx: 0 } , state=FINISHED_SUCCESS. blocked reactor thread for 58550us. Trace: : 0327 18:20:45.649150 (+ 0us) outbound_call.cc:184] Outbound Call initiated. 0327 18:20:45.649230 (+ 80us) outbound_call.cc:390] Queued. 0327 18:20:45.649240 (+ 10us) outbound_call.cc:401] Call Sent. 0327 18:20:45.788850 (+139610us) async_rpc.cc:132] AsyncRpc::Finished Begin 0327 18:20:45.788883 (+ 33us) async_rpc.cc:135] AsyncRpc::Finished Done with Done() new_status = OK 0327 18:20:45.790643 (+ 1760us) async_rpc.cc:137] AsyncRpc::Finished ProcessedResponseFromTserver 0327 18:20:45.790844 (+ 201us) async_rpc.cc:139] see line 0327 18:20:45.790847 (+ 3us) batcher.cc:171] CheckForFinishedFlush 0327 18:20:45.790856 (+ 9us) batcher.cc:181] Updated state 0327 18:20:45.790878 (+ 22us) batcher.cc:188] Set FlushFinished 0327 18:20:45.790883 (+ 5us) batcher.cc:205] submitting flush_callback_ 0327 18:20:45.790964 (+ 81us) batcher.cc:220] submitted flush_callback_ 0327 18:20:45.790967 (+ 3us) async_rpc.cc:141] see line 0327 18:20:45.791506 (+ 539us) batcher.cc:214] cb start 0327 18:20:45.791512 (+ 6us) redis_service.cc:397] BlockCallback 0327 18:20:45.791521 (+ 9us) redis_service.cc:425] Responding to 251 ops 0327 18:20:45.791999 (+ 478us) redis_service.cc:429] Responding to last op 0327 18:20:45.792003 (+ 4us) redis_service.cc:432] Responded to all ops 0327 18:20:45.792006 (+ 3us) redis_service.cc:441] Release 0327 18:20:45.792019 (+ 13us) redis_service.cc:443] Release done 0327 18:20:45.792024 (+ 5us) redis_service.cc:452] Processsed done 0327 18:20:45.792025 (+ 1us) redis_service.cc:401] BlockCallback Done 0327 18:20:45.792027 (+ 2us) redis_service.cc:403] BlockCallback block_ reset 0327 18:20:45.792029 (+ 2us) batcher.cc:217] cb end 0327 18:20:45.847360 (+ 55331us) async_rpc.cc:144] AsyncRpc::Finished All done 0327 18:20:45.847377 (+ 17us) outbound_call.cc:328] Done calling 0327 18:20:45.847383 (+ 6us) outbound_call.cc:334] Done freeing 0327 18:20:45.847401 (+ 18us) trace.cc:320] Dumping to list Related trace: Reviewers: kannan, mikhail, robert, sergei Reviewed By: sergei Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D4432
- Loading branch information
1 parent
c8908ae
commit c2555ed
Showing
10 changed files
with
79 additions
and
26 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
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
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
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
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