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

Optimize TSQL outbox cleanup by reducing batch size and adding rowlock hint #1249

Merged
merged 7 commits into from
Sep 12, 2023

Conversation

ramonsmits
Copy link
Member

@ramonsmits ramonsmits commented Jul 27, 2023

Resolves:

Optimize TSQL outbox cleanup by

  1. Reducing batch size to prevent lock escalation to page/table locks
  2. Add hint to prevent escalation from row to page locks to not conflict with regular incoming message outbox operations as DELETE does not have to be efficient and should avoid any lock escalation over performance

To prevent lock escalation to page/table locks the number of rows must not be over 4.000 or 5.000 rows

Google states multiple resources that either going over 4.000 or 5.000 rows results into lock escalation from row to page/table locks:

…t not be over 4.000

Google states multiple resources that either going over 4.000 or 5.000 rows results into lock escalation from row to page/table locks
…n and prevent dead-locks with regular outbox operations as outbox deletes do not have to be efficient
@ramonsmits ramonsmits changed the title Reduce batch size to prevent lock escalation to page/table locks Optimize outbox cleanup Jul 27, 2023
@ramonsmits ramonsmits changed the title Optimize outbox cleanup Optimize TSQL outbox cleanup Jul 27, 2023
@ramonsmits ramonsmits self-assigned this Jul 27, 2023
@ramonsmits ramonsmits changed the title Optimize TSQL outbox cleanup Optimize TSQL outbox cleanup by reducing batch size and rowlock hint Jul 27, 2023
@ramonsmits ramonsmits added this to the vNext milestone Jul 31, 2023
@ramonsmits ramonsmits changed the title Optimize TSQL outbox cleanup by reducing batch size and rowlock hint Optimize TSQL outbox cleanup by reducing batch size and adding rowlock hint Aug 1, 2023
@ramonsmits ramonsmits marked this pull request as ready for review August 1, 2023 07:38
@github-actions
Copy link

github-actions bot commented Sep 1, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 1, 2023
@github-actions github-actions bot closed this Sep 9, 2023
@udidahan
Copy link
Member

Given the approval, it seems like this was validated as having some benefit, so why was it not followed through on?

@ramonsmits ramonsmits reopened this Sep 12, 2023
@ramonsmits
Copy link
Member Author

Given the approval, it seems like this was validated as having some benefit, so why was it not followed through on?

No specific reason except this didn't show up in the github notifications and due to your comment it did.

@ramonsmits ramonsmits enabled auto-merge (squash) September 12, 2023 14:19
@ramonsmits ramonsmits merged commit 1e88b7b into master Sep 12, 2023
@ramonsmits ramonsmits deleted the tsql-outbox-cleanup branch September 12, 2023 14:43
@udidahan
Copy link
Member

I would have thought that the ping from the bot would have triggered the same notification, but ok.

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

Successfully merging this pull request may close these issues.

3 participants