mysqldump-php icon indicating copy to clipboard operation
mysqldump-php copied to clipboard

Faster dump by less tiny writes()

Open staabm opened this issue 1 year ago • 2 comments

while writing the dump the script is doing millions of tiny writes().

after this PR we are buffering the contents within a string a do the write only after we reached the net-buffer-length. this means we are doing waaaay less IO calls.

before this PR:

mstaab@mst22:/cluster/www/www/www/mysqldump-php$ time php test2.php

real    0m14.194s
user    0m10.762s
sys     0m2.340s

after this PR

mstaab@mst22:/cluster/www/www/www/mysqldump-php$ time php test2.php

real    0m7.492s
user    0m6.403s
sys     0m0.204s

which is now 40-50% faster 🚀

staabm avatar Feb 22 '24 08:02 staabm

What if you have very large tables? In my case i have a table of ~90gb and growing

stempora avatar Jul 03 '24 11:07 stempora

Give it a try and report back :-)

staabm avatar Jul 03 '24 12:07 staabm

Hi, thanks for the PR and the time you took to evaluate this. During your tests... did you use compression output or was it disabled? Please see #284.

ifsnop avatar Sep 02 '24 09:09 ifsnop

As far as I remember I used default settings / not sure whether this means compressed or not

staabm avatar Sep 02 '24 10:09 staabm

By default, compression is configured to None. So I think the option to buffer only when compression is None is better, let me do some tests and I will update the PR and fix the issue.

Thanks for your effort.

Message ID: @.***>

ifsnop avatar Sep 02 '24 11:09 ifsnop

This makes more sense than #284.

ifsnop avatar Sep 20 '24 00:09 ifsnop