[MDEV-32777] DDL operations very slow under macOS Created: 2023-11-11 Updated: 2024-01-22 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Data Definition - Create Table |
| Affects Version/s: | 10.11.5, 11.3.0 |
| Fix Version/s: | 10.11 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Ben Osheroff | Assignee: | Dave Gosselin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MacOS 13.6, m1 Macbook Pro. Homebrew binaries |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Under MacOS, MariaDB appears to be an order of magnitude slower than either linux or mysql8 when executing DDL statements. Executing the attached script (simply creating/dropping a table repeatedly) gives the following results:
this makes running unit tests that do a lot of tight-loop DDL more or less unusable under mac/maria. Thanks for your time, LMK if you need any more info. |
| Comments |
| Comment by Vladislav Vaintroub [ 2023-11-11 ] |
|
Possibly relevant : https://mjtsai.com/blog/2022/02/17/apple-ssd-benchmarks-and-f_fullsync/ 5. Since nobody is using macOS as production platform, maybe MariaDB can do that, too |
| Comment by Marko Mäkelä [ 2023-11-13 ] |
|
The F_FULLFSYNC was actually being used in InnoDB back in 2005 (see the original commit, fixup 1 and fixup 2). I think that around that time, MySQL and InnoDB were being used as an embedded database in some proprietary products that ran on the platform. The last traces of InnoDB F_FULLSYNC were removed in MySQL 5.7 in 2013. It looks like the code may have been effectively disabled already when MySQL moved to the CMake build system; the preprocessor symbol HAVE_DARWIN_THREADS was not defined even in MySQL 5.5 as far as I can tell. |
| Comment by Vladislav Vaintroub [ 2023-11-13 ] |
|
MDEV-24105 recommends to "restore F_FULLSYNC to full glory", and in light of this one, I'm unsure. |
| Comment by Dave Gosselin [ 2023-12-18 ] |
|
I was drawn to this ticket initially by Marko during a November 8, 2023 slack conversation in the #engineering channel, regarding slow test performance on macOS. This ticket isn't necessarily directly related to slow test performance, but may impact it to some degree, meriting exploration. Correspondingly, I created TODO-4441 to track macOS test support. For the present issue, changing my_sync as MySQL did in https://github.com/mysql/mysql-server/commit/3cb16e9c3879d1790159d2856cb7aa0bd3d201fd makes the attached script of DDL run in about 400ms on my M1 macbook pro running macOS 13.6.3. Without this change, it takes about 5s; both measurements are consistent with the reporter's observation. -DCMAKE_BUILD_TYPE=Debug \ Arguments to mtr under both environments (note no use of ramdisk as, while macOS supports ramdisk, macOS does not support an implementation of /dev/shm for ramdisk): --force --max-test-fail=0 --parallel=auto --suite=main |
| Comment by Marko Mäkelä [ 2023-12-19 ] |
|
Gosselin, I would expect some tests to run slower if they didn’t set innodb_flush_log_at_trx_commit=0 or if we set sync_binlog=1 by default (MDEV-16589). Very few tests exercise group commit; in fact, the majority of tests use a single connection of the single-threaded test client, so we should not see any group commit optimizations in action. Did you try to create a directory on RAM disk and make mysql-test/var a symbolic link that points there? In mysql-test/mariadb-test-run.pl you could search for tmpfs_locations to find the defaults and some related parameters. Did you experiment with F_BARRIERFSYNC, which is mentioned in MDEV-24105? |
| Comment by Dave Gosselin [ 2023-12-19 ] |
|
Hi marko, thank you for the flags, I will experiment with those. I successfully made a RAMdisk on macOS a few weeks back and tested with that and it was still much slower than linux; I don't have exact numbers but it wasn't competitive with Linux. I did not experiment with F_BARRIERSYNC, I will try that and see if it's viable in lieu of following MySQL's path as mentioned earlier. Thank you! |