Download & Extend

Poor performance of batch API with large queues

Project:Drupal core
Version:7.x-dev
Component:forms system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:Performance

Issue Summary

I'm a bit new to all this D7 stuff, but I was generating content using devel generate, and tried to create 500,000 items. It was taking a long time to complete, and so I investigated, and the line that was taking a long time to execute was:

<?php
class BatchQueue extends SystemQueue {

  public function
claimItem($lease_time = 0) {
   
$item = db_query('SELECT data, item_id FROM {queue} q WHERE name = :name ORDER BY item_id ASC', array(':name' => $this->name))->fetchObject();
?>

Which was returning 500,000 rows from the db to just get the first one :( Sad times.

Patch on its way.

Comments

#1

Status:active» needs review

Patch attached. Let's see what the testbot thinks.

AttachmentSizeStatusTest resultOperations
drupal-batch-performance-985184.patch830 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 28,830 pass(es).View details

#2

Status:needs review» reviewed & tested by the community

Ouch. Nice catch.

#3

Status:reviewed & tested by the community» fixed

D'oh! :)

Committed to HEAD. Thanks!

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.