What happened?
Description
When the queue contains a large number of jobs and the job column is large, the queue performance slows.
I believe this is due to the reserve method in the queue service sorting by priority, but the queue table not having an index for the priority column.
To test this, I created a dummy job class with an empty execute method and a large (200kb+) string parameter.
Obviously this is an extreme example, but we initially noticed this with Commerce jobs for order emails & catalog pricing.
When I add a composite index for channel, priority and id, performance is restored.
Steps to reproduce
- Push a large number of jobs into the queue, where the job column blob is also relatively large
- Observe query to reserve the job taking a longer amount of time
Expected behavior
Queue runs fast
Actual behavior
Queue runs slower than it could do
Craft CMS version
5.10.5
PHP version
8.5
Operating system and version
No response
Database type and version
MySQL 8.4.7
Image driver and version
No response
Installed plugins and versions
No response
What happened?
Description
When the queue contains a large number of jobs and the job column is large, the queue performance slows.
I believe this is due to the reserve method in the queue service sorting by priority, but the queue table not having an index for the priority column.
To test this, I created a dummy job class with an empty execute method and a large (200kb+) string parameter.
Obviously this is an extreme example, but we initially noticed this with Commerce jobs for order emails & catalog pricing.
When I add a composite index for channel, priority and id, performance is restored.
Steps to reproduce
Expected behavior
Queue runs fast
Actual behavior
Queue runs slower than it could do
Craft CMS version
5.10.5
PHP version
8.5
Operating system and version
No response
Database type and version
MySQL 8.4.7
Image driver and version
No response
Installed plugins and versions
No response