forked from facebook/watchman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve perf for subscriptions and triggers
Summary: We noticed that client threads could apparently spin calling PubSub::getNext. Looking at the `log-level debug` output while this is happening in one of our big repos shows that the trigger assessment is very aggressively calling getNext in a loop, closely followed by the approximately 10 subscriptions that are also associated with this repo. These dispatches have mostly nothing to do in these situations; the wakeups are just due to the settle notifications that are exponentially backing off. So if you have a default or relatively small settle period configured in the root, you'll see these run quite hot for a while until the sleep interval backs off sufficiently. To help avoid this being so busy, rather than calling getNext() in a loop we can call the getPending() method to return the vector of all pending items in a chunk (which only requires one lock call to get all items). Then we can process that chunk and collect whether the settle payload appears, dispatching the trigger or subscription just once for the batch of items. Reviewed By: sid0 Differential Revision: D4302635 fbshipit-source-id: 7f187f0578d17f1dc2a932e1ff8337fc0e3ed514
- Loading branch information
Showing
5 changed files
with
45 additions
and
38 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