-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimization: Remove constraints on arrow firing #378
Merged
Merged
Conversation
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
Resolves confusion between max_inflight_events and event_pool_capacity when the number of locations != 1
This is two fewer locks on every attempt to execute an arrow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, the scheduler would assign arrows to workers with only a hint as to whether they could actually fire. Firing logic was complex, attempting to pop some number of events for each input queue, reserving space for a predetermined number of events on each output queue, and in case fewer events proved poppable/reservable than desired, reverting the operation. This led to two problems:
Locks needed to be acquired for each input and output queue both before firing and after, whether firing was successful or not.
If the preconditions were not met, the worker would retry firing, but with a delay. Since the worker has no indication of whether the arrow was about to become fire-able or not, this leads to unnecessary waiting in places where no work is available, when work is available elsewhere. Conversely, when an event source is delayed due to having no data ready on a socket, or due to a barrier event, this leads to the scheduler rapidly hammering the event source when a more appropriate action would be to wait.
This PR refactors JArrow in order to address issue (1) and clear the way for addressing issue (2). It does the following:
Making reservations on output queues is no longer necessary, as queues are now sized to always hold
max_inflight_events
items.Arrows have been refactored to support a much simpler (and easier to achieve) trigger. In order to successfully execute, each arrow needs exactly one event from one predetermined queue, (plus an optional delay parameter for polling sockets and barrier events). This should decrease the number of spurious retries in more complex processing topologies, and make debugging, inspection, visualization, and timeout logic much cleaner.
The very general
JArrow::Place
andJArrow::Data
machinery (which was introduced in order to keep the now-removed pull/reserve/revert logic tractable) has been replaced by a much simplerJArrow::Port
that removes a few virtual function calls and makes it possible to generically wire arbitraryJArrows
together via a config parameter.