I recently added complete unit test coverage to my simpletest module, both for 6.x and 7.0 UNSTABLE 7.

The same set of tests (currently in CVS), on the same module (except for the minor changes needed for the port), on the same server, takes about three times as long on D7 than on D6. I haven't noticed similar speed differences for anything else on D7 vs D6.

D7 version: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/taxonews/ta...

D6 version: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/taxonews/ta...

Comments

fgm’s picture

eerrrrr... I mean my "taxonews" module, not "simpletest", of course.

Obviously, this can also be an error in my tests, but I somehow doubt it because they are not very complicated.

chx’s picture

Curious. Have you tried running xdebug and kcachegrind to see what's going on? Is db_insert this much slower? Can be... but still curious.

damien tournoud’s picture

Well, the registry can explain a big part of that. Even if we do preload the registry, we still have to traverse the hierarchy of files and compute md5() hashes of them. That's not cheap.

boombatower’s picture

Status: Active » Postponed (maintainer needs more info)

Looks like we need someone to take the time to debug this.

catch’s picture

Status: Postponed (maintainer needs more info) » Active

We do, but the issue is definitely there, so it should stay active.

fgm’s picture

Just an idea about this: how about forcing a MEMORY engine when creating the simpletest tables, if one exists ? It should greatly speed up creation, tests, and cleanup of the test DB. Isn't it more or less what the t.d.o. slaves do ?

boombatower’s picture

Yes, they are configured to run mysql in memory using a variety of methods including tmpfs. Seems like a reasonable idea, I'm not sure if there are any reason not to.

Patches welcome.

damien tournoud’s picture

As far as I know, Drupal cannot run with MEMORY engines.

boombatower’s picture

Seems like a good reason. :)

fgm’s picture

There is indeed a problem: the MEMORY engine does not support any sort of blob column. So I only changed those tables which did not include some sort of blob (had you noticed how many blobs we are using ?), and didn't notice any problem in an interactive session. Not to say there wouldn't be any, but nothing obvious.

This sad part is that when cloning the DB, simpletest creates the tables with the default engine, not respecting the engine of the original table being cloned. Wouldn't that be a bug ?

I also did a few tests to try optimizing runs a bit, by varying the file system hosting the DB, and by using stock D7U7 or by tweaking the default engine in database/mysql/schema.inc (currently defaulting to 'InnoDB'). In summary, normalizing durations:

  • normal D7U7, disk-based instance: 100
  • normal D7U7, ram-based instance: 85
  • D7U7 'mysql_engine' => 'MyISAM',: disk-based 60
  • D7U7 'mysql_engine' => 'MyISAM',: ram-based instance: 45

So FWIW it looks that, at least for testing on that specific machine, the combination of a ram file system and forcing the engine to MyISAM instead of InnoDB is a clear winner. Dunno if that would translate to the t.d.o. testing slaves.

damien tournoud’s picture

@fgm: That's exactly what we are doing for a while now. This, combined with concurrency, allow us to run the full test suite in about 4 minutes.

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new6.73 KB

Let's try that anyway.

dries’s picture

Performance tests? :)

Would be nice if the tests results (e.g. http://testing.drupal.org/pifr/file/1/513592-registry-speedup-md5.patch) reported execution time. Wouldn't be very academic but still useful.

fgm’s picture

Continuing tests, with this morning's HEAD (≥ 2 runs per scenario). Without DamZ' patch, then with it, normalized to HEAD defaults:

  • InnoDB, disk: 100 / 79
  • InnoDB, ram: 69 / 64
  • MyISAM: disk: 69 / 69
  • MyISAM, ram: 67 / 62

So overall, the patch is significant when both engine and storage are is already optimized, meaning PHP load becomes is no longer dominated by DB load.

Anonymous’s picture

nice idea damz!

any false positives would be very rare and only cause a file reparse, which is no big deal.

false negatives would be even rarer. +1 from me.

Mike Wacker’s picture

FYI, I've ran Simpletest on both Drupal 6 and Drupal 7 and definitely notice the speed difference mentioned in this issue.

dries’s picture

Status: Needs review » Reviewed & tested by the community

I'm OK with this so I'm marking this RTBC -- an extra review wouldn't hurt.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed DamZ's patch. Thanks all!

Status: Fixed » Closed (fixed)
Issue tags: -Performance

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