Page MenuHomePhabricator

Investigate if we can speed up core phpunit default suite (with database)
Closed, ResolvedPublicSpike

Description

PHPUnit tests that use the database are the longest running step in the quibble-for-mediawiki-core-vendor-mysql-php83 CI job, currently averaging ~8 minutes.
As we invest in other job changes, we should first determine whether "configuration level tweaks" following PHPUnit best testing practices could meaningfully reduce that runtime.

Acceptance criteria:

  • Check if there are performance related changes to our PHPUnit configurations that could improve performance.
  • If actionable improvements are identified, create a follow-up implementation ticket.
  • If no actionable improvements are found, close the ticket

ToDo:

  • Enable parallel PHPUnit tests for all jobs.

Event Timeline

Restricted Application changed the subtype of this task from "Task" to "Spike". · View Herald TranscriptApr 2 2026, 1:18 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

MediaWiki core tests do not run in parallel and instead run in serial. The biggest challenge to running the tests in parallel is that SQLite does not work well when it comes to database concurrency, eg ( T407954 ) This issue might be unique to our unit tests setup, as we are using a custom setup to run the tests in parallel. MySQL handles concurrency better, and a solution to speeding up the unit test job would be to run unit tests in parallel by default and fall back to running in serial whenever the --sqlite db args are detected. This will give us the benefit of faster runs and give us security whenever we run SQLite tests.

This tried setting synchronous = OFF, which reduces fsync overhead, but doesn't address concurrent access. Has anyone tried PRAGMA journal_mode = WAL? WAL mode is the SQLite setting that allows concurrent readers alongside a writer, which seems more directly relevant to the parallelization blocker described here.

Worth noting: journal_mode isn't in MediaWiki's VALID_PRAGMAS allowlist in DatabaseSqlite.php (which only permits synchronous, temp_store, mmap_size, and cache_size), so a Quibble config change alone wouldn't be enough. A MediaWiki core patch adding journal_mode to that allowlist might be a prerequisite before it could be tested in CI?

Thought I'd mention it in case this path wasn't considered / in case it's worth exploring.