ref(TaskProducer): free up the GIL more - #733
Merged
Merged
Conversation
untitaker
approved these changes
Jun 29, 2026
| "processing_pool": processing_pool_name, | ||
| }, | ||
| ) | ||
| for task in pending_task_futures.copy(): |
Member
There was a problem hiding this comment.
I wonder if you want to use concurrent.futures.wait here
Member
Author
There was a problem hiding this comment.
I'll take a look at other improvements such as this in a later PR
3 tasks
bmckerry
added a commit
to getsentry/sentry
that referenced
this pull request
Jun 30, 2026
getsentry/taskbroker#733 added a configurable sleep to each iteration of the workerchild future checking thread. This PR adds that argument to sentry's `run taskworker`.
shayna-ch
pushed a commit
to getsentry/sentry
that referenced
this pull request
Jun 30, 2026
getsentry/taskbroker#733 added a configurable sleep to each iteration of the workerchild future checking thread. This PR adds that argument to sentry's `run taskworker`.
This file contains hidden or 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
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.
When enabling TaskProducer for sentry's
track_outcome(), latency until the producer delivery callback was called spiked.I'm assuming this is because:
track_outcome()is higher throughput for producing than anything else I've enabled TaskProducer forThis PR attempts to fix this by:
taskworker.task.futures_producedmetric: https://github.com/getsentry/taskbroker/blob/main/clients/python/src/taskbroker_client/worker/workerchild.py#L532-L541check_task_future_completion- previously this only paused if there were no producer futures from a task, this should free up the GIL more and allow us to find an optimal pause value per TaskWorker instance