Skip to content
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

Batch job processing #470

Closed
wants to merge 20 commits into from
Closed

Batch job processing #470

wants to merge 20 commits into from

Conversation

benjie
Copy link
Member

@benjie benjie commented Jun 6, 2024

Description

Replaces #99.

The PR gives the ability to configure Graphile Worker such that getJob, completeJob and failJob can be batched:

  • Pools are now responsible for getting jobs and will grab the number of jobs that you specify up front, and distribute these to workers on demand; each time their queue is exhausted they'll fetch another batch
  • Pools are also now responsible for completing and failing jobs; they will wait the specified number of milliseconds after a completeJob or failJob call and see if any other calls are made in the interrim; all of these results will be sent to the database at the same time reducing the total number of transactions.

Note that enabling these features changes the behavior of Worker in a few ways:

  • Since pools grab a number of jobs up front they represent a snapshot at that time and newer higher priority jobs will not be evaluated until the queue is exhausted
  • Since pools grab a number of jobs up front jobs may not be as evenly distributed across workers
  • Since pools grab a number of jobs up front, jobs may not start until a later time than they previously did, increasing latency (but also increasing throughput)

Performance impact

If not enabled, impact is minimal.

If enabled, throughput improvement at the cost of potential latency increases

Security impact

Not known.

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

@benjie benjie mentioned this pull request Jun 6, 2024
7 tasks
@benjie benjie mentioned this pull request Jun 11, 2024
5 tasks
@benjie
Copy link
Member Author

benjie commented Jun 11, 2024

Closing in favour of #474

@benjie benjie closed this Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant