Parallel processing of invalidations / purger taking lock

Created on 30 July 2020, about 4 years ago
Updated 4 April 2024, 6 months ago

Problem/Motivation

I'm looking at creating a plugin that can do some invalidations across a cluster of machines on each machine. I figured it would be useful to utilise the queueing system and just hide the fact that the queue claimItem() on each machine returns different items specific to invalidations needed on that machine (in my case, Varnish invalidations across a fleet.) So rather than implementing an external queue, using purge's.

I ran into an issue though that was unexpected. The PurgersService has a processing lock. So even though I'm running my own processor I cannot actually run my processor in parallel - only one can run at any one time.

Is there a specific design consideration for the lock within the PurgersService? What are the thoughts on a small patch to add new plugin definition so that a processor can request that the lock in purgers not be taken so it can process in parallel?

Steps to reproduce

Requires some fairly extensive plugin customisation but happy to help describe. I'm going to try open source if I can at some point but it's not there yet and I need approval.

Proposed resolution

Assuming I'm not missing something (there's a huge library of plugins to consider so I may be!), I wonder if a processor could request that it does not need a lock. It could be done by a new plugin definition statement: "aquire_global_lock = FALSE". The processor can then obtain it's own lock and parallel process if it wants to (our queue and purger plugins support this.)

Remaining tasks

-

User interface changes

-

API changes

New plugin definition for processors: aquire_global_lock
Default value: TRUE. Fully backwards compatible as a result.

Data model changes

-

Feature request
Status

Active

Version

3.5

Component

Code

Created by

🇬🇧United Kingdom Driskell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024