User:Hashar/bug41607

From Wikitech-static
Jump to navigation Jump to search

Running the Dump PHPUnit test suite from scratch

Install a snapshot of MediaWiki using sqlite:

wget https://integration.mediawiki.org/nightly/mediawiki/core/mediawiki-78a5729.zip
unzip mediawiki-78a5729.zip
cd mediawiki-78a5729
# Install a basic database using sqlite as a backend
php maintenance/install.php benchwiki sysop --pass secret --dbtype sqlite --dbpath .

# Run the Dump test suite
php tests/phpunit/phpunit.php --group Dump
Run CDB tests

MediaWiki has a test suite for CDB files wich does a few read and writes to CDB files:

 php tests/phpunit/phpunit.php tests/phpunit/includes/CdbTest.php

It writes 1000 times some small random strings. One could adjusts the value in the tests/phpunit/includes/CdbTest.php to get a longer loop aka 1000 -> 1000 * 1000 and use longer strings: $len = mt_rand( 0, 10 ); -> $len = mt_rand( 1000, 2000 );

Perf report

From Faidon:

perf record -- php [..]
perf report


Hashar's random (useless) traces

With strace -c (count):

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 69.86    0.022932           0   5117222           rt_sigprocmask
 16.49    0.005412         677         8           clone
 12.19    0.004000           5       760           fsync
  0.64    0.000209           0      9063        16 lseek
  0.56    0.000183           0     11384           write
  0.08    0.000026           0      1226        20 open
  0.05    0.000015           0      1293           close
  0.04    0.000014           0       567           brk
  0.04    0.000014           0      1193       786 access
  0.04    0.000012           0      3589           fstat
snip...

strace -c -f (count and follow forks):

PHPUnit time: 02:48

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 41.11    0.025380           0   5471037           rt_sigprocmask
 38.88    0.024002          32       760           fsync
 13.79    0.008514         608        14           wait4
  2.72    0.001679           1      2700           read
  2.70    0.001667         111        15           clone
  0.41    0.000256           0     11578           write
  0.24    0.000148           1       231           unlink
  0.04    0.000023           0      9063        16 lseek
  0.03    0.000020           0      1276        20 open
  0.02    0.000013           0      3638           fstat
  0.02    0.000013           0      3425           fcntl
  0.02    0.000013           0       793           getcwd
  0.01    0.000008           0      5814        43 lstat
  0.00    0.000000           0      1392           close
  0.00    0.000000           0      1504        58 stat
  0.00    0.000000           0         1           poll
  0.00    0.000000           0       965           mmap
  0.00    0.000000           0       245           mprotect
  0.00    0.000000           0       691           munmap
  0.00    0.000000           0       594           brk
  0.00    0.000000           0       177           rt_sigaction
  0.00    0.000000           0         7           rt_sigreturn
  0.00    0.000000           0        33        22 ioctl
  0.00    0.000000           0      1249       842 access