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

Extensive use of Cancellation Token checks for long running processes can cause performance issues #99

Open
CliffSenkbeil-AI opened this issue Oct 31, 2019 · 1 comment

Comments

@CliffSenkbeil-AI
Copy link

CliffSenkbeil-AI commented Oct 31, 2019

We have found that the use of cancellation tokens (using Hangfire v.1.6.22+) can generate a lot of database load and can significantly reduce performance of long running tasks if called too frequently. More clarity in the documentation regarding "Using cancellation tokens" that it triggers code blocking database calls should be mentioned to help other Hangfire users improve their task performance when faced with this issue.

@CliffSenkbeil-AI CliffSenkbeil-AI changed the title Use of Cancellation Methods for long running processes can cauase performance issues Use of Cancellation Methods for long running processes can cause performance issues Oct 31, 2019
@CliffSenkbeil-AI CliffSenkbeil-AI changed the title Use of Cancellation Methods for long running processes can cause performance issues Extensive use of Cancellation Methods for long running processes can cause performance issues Oct 31, 2019
@CliffSenkbeil-AI CliffSenkbeil-AI changed the title Extensive use of Cancellation Methods for long running processes can cause performance issues Extensive use of Cancellation Token checks for long running processes can cause performance issues Oct 31, 2019
@odinserj
Copy link
Member

Starting from Hangfire 1.7.0 it's possible to use regular CancellationToken parameters in your jobs. They are updated asynchronously, and no calls to ThrowIfCancellationRequested will lead to any network call. CancellationCheckInterval option controls how often cancellation tokens will be checked against the current job state.

I've just scheduled a work item to update the documentation, thank you for the hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants