Skip to content

Cache failed PDO and SNMP service probes - #22944

Draft
NickSdot wants to merge 4 commits into
php:masterfrom
NickSdot:perf/cache-test-service-probes
Draft

Cache failed PDO and SNMP service probes#22944
NickSdot wants to merge 4 commits into
php:masterfrom
NickSdot:perf/cache-test-service-probes

Conversation

@NickSdot

@NickSdot NickSdot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Extracted from #22917.

Prevents unavailable optional test services from slowing the suite through repeated connection timeouts. PDO and SNMP availability probes cache the first failure for the duration of one test run, so later SKIPIF checks return immediately.

Only failures are cached; successful probes and test connections are unchanged. PDOs one second timeout applies only to the default availability probe. The caches are private, run-scoped and removed afterwards. A service becoming available mid run is detected on the next test-suite run.

Result

Values in seconds; measured on macOS.

mode master this PR saved speedup
-j1 285.246 8.991 276.255 31,72×
-j10 221.144 4.560 216.584 48,49×

Reproduction:

sapi/cli/php run-tests.php -q -j1 ext/pdo ext/pdo_dblib ext/snmp
sapi/cli/php run-tests.php -q -j10 ext/pdo ext/pdo_dblib ext/snmp

Result (after #22944 (comment) )

Added caching for ext/ldap, ext/pgsql, ext/mysqli, ext/pdo_mysql, ext/odbc.

mode master this PR saved speedup
-j1 313.740 35.177 278.563 8,91x
-j10 241.474 13.781 227.693 17.52x

Reproduction:

sapi/cli/php run-tests.php -q -j1  ext/pdo ext/pdo_dblib ext/snmp ext/ldap ext/pgsql ext/mysqli ext/pdo_mysql ext/odbc
sapi/cli/php run-tests.php -q -j10  ext/pdo ext/pdo_dblib ext/snmp ext/ldap ext/pgsql ext/mysqli ext/pdo_mysql ext/odbc

@TimWolla TimWolla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without looking too deeply into it: There is already a SkipCache in the test runner, why doesn't it work?

@NickSdot

Copy link
Copy Markdown
Contributor Author

Without looking too deeply into it: There is already a SkipCache in the test runner, why doesn't it work?

SkipCache is not actually related. This here actively caches expensive failures across parallel workers so that same following calls do not run into the same timeouts over and over again.

@arnaud-lb

Copy link
Copy Markdown
Member

I believe it has the same purpose, but it's less efficient since it doesn't share its state between workers. However it's more general and avoids introducing complexity into individual tests, so if we could improve it, this would be better.

We could update SkipCache so that it shares its state between workers. E.g. store results in individual files /tmp/run-tests-skipif-{pid}/{key}/{code hash} instead of this->skips[$key][$code].

@NickSdot
NickSdot force-pushed the perf/cache-test-service-probes branch from 2075f43 to 300a315 Compare August 2, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants