Skip to content

Excessive polling on solid_queue_semaphores causes CPU to spike to 100% #630

@salmonsteak1

Description

@salmonsteak1

Hello,

May I clarify how concurrency controls work in Solid Queue? From reading the README on concurrency controls , I have a general idea that the dispatcher checks for blocked jobs in the solid_queue_blocked_execution table, and moves it to the solid_queue_ready_execution table if a lock can be acquired from the solid_queue_semaphores table, please correct me if I'm wrong

The reason I'm asking is because I recently experienced a CPU spike for my Postgres database and upon closer inspection, there were alot of queries like these:

UPDATE "solid_queue_semaphores" SET value = value + 1, expires_at = '2025-08-28 13:52:06.939437' WHERE "solid_queue_semaphores"."key" = 'testing_key_1' AND "solid_queue_semaphores"."value" < 30 /*job='TestJob'*/

Once I stopped enqueuing these jobs that had this key, the CPU spike dropped (and the queries were gone).

There were also a lot of these "transactional" and "tuple" lock that is probably on the solid_queue_semaphores table in the time the CPU spiked to 100%:

Image

If what I read in the README was true, wouldn't that mean that only the dispatchers are hitting the solid_queue_semaphores table (which is a very small number at a polling rate of 1s)? I'm not sure why am I getting these huge spikes in locks and CPU

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions