NServiceBus.Persistence.Sql icon indicating copy to clipboard operation
NServiceBus.Persistence.Sql copied to clipboard

Randomize outbox cleanup sleep duration and/or add jitter to decrease running cleanup on multiple instances concurrently

Open ramonsmits opened this issue 2 years ago • 0 comments

Describe the suggested improvement

Currently, the sleep interval for outbox cleanup is fixed. A user reported that often this causes issue just after a deployment of a new version as all instances are pretty much aligned on the sleep duration.

To minimize overlap in cleanup it could

  • Have a random delay on the first outbox cleanup (for example rnd(1)*CleanupInterval)
  • Add jitter to each sleep to decrease the change of running cleanup on multiple instances (for example CleanupInterval/2 + rnd(1)CleanUpInterval)

Additional Context

No response

ramonsmits avatar Jul 25 '23 16:07 ramonsmits