yugabyte-db icon indicating copy to clipboard operation
yugabyte-db copied to clipboard

[dst] Improve the continuation of waiters in wait_queue.cc

Open robertsami opened this issue 2 years ago • 0 comments

Jira Link: DB-3158 Whenever a tracked blocker is resolved in the WaitQueue, our process for determining which waiters can be resumed and subsequently resuming them could be improved in a few ways:

  1. We currently iterate over each of the blocker's waiters and separately acquire a write lock on a mutex to remove the waiter from waiter_status_ before resuming the waiter. We need not re-acquire this write lock for every waiter and can simply acquire it once
  2. We currently resume waiters in the order they arrived, and in serial on a single thread. It might be better to understand which of the waiters will conflict with each other, and then either: a. Resolve the first-in waiter and all non-conflicting other waiters in parallel b. Resolve the largest set of non-conflicting waiters in parallel, then the second largest, etc
  3. Maybe before trying 2., an even simpler approach of just resolving all waiters in parallel will be an improvement

https://github.com/yugabyte/yugabyte-db/blob/master/src/yb/docdb/wait_queue.cc#L328

robertsami avatar Aug 11 '22 14:08 robertsami