Open Closed

BackgroundJobWorker - Constant LockKey #8342


User avatar
0
mgurer created
  • ABP Framework version: v9.0.0
  • UI Type: Blazor Server
  • Database System: EF Core (PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello.

I have just updated my code base to use couchbase as distributed cache and lock provider.

Everything goes fine.

During my tests, I have noticed a behavior about distributed locks for BackgroundJobWorker.

The class implementation uses constant "AbpBackgroundJobWorker" string as lock key.

I have maybe 50 microservices and each microservice has their own database and each database has own "AbpBackgroundJobs" table.

Each microservice runs this BackgroundJobWorker periodically (a bit often) and on every call the lock is activated using same lock key ("AbpBackgroundJobWorker"). I use Volo.Abp.BackgroundJobs.EntityFrameworkCore library to store job queue on database.

Since microservices has their own separate databases, blocking microservices with same lock-key seems to me a little bit inefficient. This blockage goes up depending on the number of microservices.

I suggest appending the database name as a suffix to the lock key or add an option to set this key separately for each microservice so that microservices do not block each other.

I would like to alter this implementation according to my suggestion, but I like to ensure that I do not miss any logic that made you use same lock-key.

Do you have any comment about this issue?

Thanks. Murat


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    This is reasonable, we will support it in the next version https://github.com/abpframework/abp/issues/21458

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09