Skip to content

Conversation

NattyNarwhal
Copy link
Member

For whatever reason, mysql tests are apocalyptically slow on ppc64 (presumably -O0 ASAN makes this much worse).

skipSlow is enabled, which skips some other tests, consistent with the Alpine nightly job. Could reconsider enabling some of these even in skipSlow.

For whatever reason, mysql tests are apocalyptically slow on ppc64
(presumably -O0 ASAN makes this much worse).

skipSlow is enabled, which skips some other tests, consistent with the
Alpine nightly job. Could reconsider enabling some of these even in
skipSlow.
@iluuu1994
Copy link
Member

iluuu1994 commented Sep 15, 2025

The idea of skipSlow was to make the ASAN on-push job run in a reasonable amount of time. I don't know why Alpine uses this flag, possibly copy & paste. This will make the ASAN on-push job less useful for mysql development.

@iluuu1994
Copy link
Member

Looking at the number of changes in mysqli/pdo_mysql, I'd be ok with this. Though I'd still prefer trying without ASAN and with -O2 first. I don't know Gentoo, but this doesn't sound too hard? And if we just tried we'd at least know whether it makes the problems go away. I see no benefit of these flags for us.

@mvorisek
Copy link
Contributor

The mysqli should not be that slow even under heavy instrumentation.

Do you know you can run valgrind like in https://github.com/php/php-src/blob/php-8.5.0beta3/benchmark/benchmark.php#L118 to capture a callgrind profile and then analyse it using tools like KCachegrind?

@NattyNarwhal
Copy link
Member Author

The idea of skipSlow was to make the ASAN on-push job run in a reasonable amount of time. I don't know why Alpine uses this flag, possibly copy & paste. This will make the ASAN on-push job less useful for mysql development.

I can mark the Alpine nightly job as not skipSlow if it helps.

Looking at the number of changes in mysqli/pdo_mysql, I'd be ok with this. Though I'd still prefer trying without ASAN and with -O2 first. I don't know Gentoo, but this doesn't sound too hard? And if we just tried we'd at least know whether it makes the problems go away. I see no benefit of these flags for us.

mysqld itself is -O2 no ASAN, it's just mysqlnd that's eating the full performance penalty of ASAN/-O0. I guess we could force -O2 on that extension?

The mysqli should not be that slow even under heavy instrumentation.

Do you know you can run valgrind like in https://github.com/php/php-src/blob/php-8.5.0beta3/benchmark/benchmark.php#L118 to capture a callgrind profile and then analyse it using tools like KCachegrind?

I agree; I captured a flamegraph a while back in April, using perf rather than callgrind (attached). I'll try doing callgrind later.

perf.svg.gz

@iluuu1994
Copy link
Member

iluuu1994 commented Sep 15, 2025

mysqld itself is -O2 no ASAN, it's just mysqlnd that's eating the full performance penalty of ASAN/-O0. I guess we could force -O2 on that extension?

Are you referring to mysqlnd the library, or ext/mysqli & ext/pdo_mysql here? IMO, mysqlnd as well as all other libraries should be compiled with -O2 and no ASAN, while everything we ship should be compiled with ASAN. ASAN and UBSAN can catch more things without -O2, so it makes sense to stick with -O0 for our own code. At least if I understood you correctly, you're compiling mysqlnd yourself, which I understand is common on Gentoo? If mysqlnd happens to do a lot of arithmetics, which I could imagine for server communication UBSAN may have a significant impact. But it's just a guess, you've also mentioned that ASAN/UBSAN may not be particularly optimized for ppc64.

@NattyNarwhal
Copy link
Member Author

No, ext/mysqlnd (and thus mysqli/PDO_mysql) should be built against the vendored mysqlnd library one in PHP. I could build it against the system version of the mysqlnd library, but I thought we deprecated that?

@iluuu1994
Copy link
Member

Oh, I'm sorry. I have very little knowledge of mysql and it shows. I didn't realize mysqlnd was bundled with php-src. In that case, I don't know what other solution there is. 😕

@NattyNarwhal
Copy link
Member Author

Oh, I'm sorry. I have very little knowledge of mysql and it shows. I didn't realize mysqlnd was bundled with php-src. In that case, I don't know what other solution there is. 😕

I guess I could hack up the build system to drop some flags in ext/mysqlnd...

Do you know you can run valgrind like in https://github.com/php/php-src/blob/php-8.5.0beta3/benchmark/benchmark.php#L118 to capture a callgrind profile and then analyse it using tools like KCachegrind?

FWIW I tried this, and Valgrind doesn't like ASan binaries (ASan refuses to load). Without ASan is still pretty slow, but here:
callgrind.phpmysqlnd.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants