forked from facebook/folly
-
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 management of EventBase keepalives
Summary: The `EventBase` keepalive count is split across two counters, one non-atomic for in-loop operations, and one atomic for external operations (which mostly come from futures). This requires `keepAliveRelease()` to always wake up the loop, because that's the only place where it can be determined whether the counts add up to 0. The cost of doing this is very large, and more than offsets the atomic operation (which is expected to be uncontended if the majority of operations are in-loop). Furthermore, `inRunningEventBaseThread()` is not cheap either. With this diff we just use a single atomic count, so that the loop can be awoken only when the last keepalive is released, which in the common case never happens as the evbs are run with `loopForever()` in IO executors. Reviewed By: Gownta Differential Revision: D53292113 fbshipit-source-id: c0817cad98669f7538477299b7cfd180fd137243
- Loading branch information
1 parent
b6d89fa
commit 0fb2b8a
Showing
3 changed files
with
14 additions
and
28 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