Skip to content
Go Johansson (neku) edited this page Apr 15, 2024 · 4 revisions

About

Uguu version 1.8.6 and later includes a benchmark, by default when running this it will simulate 500 uploads per iteration, in total 15 iterations. The benchmark will simulate a full file upload with all functions except for moving file from tmp -> file root.

This is useful for tuning your stack that runs Uguu, as well as comparing different Uguu versions.

More benchmark modes and documentation will be added in the future.

 

Usage

First you will need a working setup of Uguu, it's not recommended to run this on a production instance since it will add a lot of records to your database.

You should also disable XDebug and OPCache before running the test.

 

Configuration Mode

You should edit src/config.json and re-compile Uguu after changing settings.

If you don't want to re-compile Uguu each time, you could also temporarily edit dist/config.json instead. Do note however that dist/config.json will be overwritten when you re-compile Uguu.

 

Normal Benchmark

Edit config.json and set the following values:

  • "DEBUG": false
  • "BENCHMARK_MODE": true
  • "ANTI_DUPE": false
  • "BLACKLIST_DB": false
  • "RATE_LIMIT": false

More modes will be added in the future in order to benchmark with the anti-dupe/blacklist/rate-limit features enabled.

 

Running Benchmark

Before running a benchmark, make sure you have set a Configuration Mode first.

 

Navigate to the Benchmark directory, make sure the following files exists.

neku@uguu:~$ cd /var/www/Uguu/dist/Benchmarks/

neku@uguu:/var/www/Uguu/dist/Benchmarks$ ls

     📄 UguuBench.php      🏞️ file.jpg      📄 runBenchmark.sh      📁 tmp/

 

Execute the benchmark script and let it finish. If all goes well you should see a result without any errors.

neku@uguu:/var/www/Uguu/dist/Benchmarks$ ./runBenchmark.sh

PHPBench (1.2.15) running benchmarks...
with configuration file: /var/www/Uguu/dist/phpbench.json
with PHP version 8.3.6, xdebug ❌, opcache ❌

\Pomf\Uguu\Benchmarks\UguuBench

    benchTest...............................I14 - Mo1.057ms (±2.21%)

Subjects: 1, Assertions: 0, Failures: 0, Errors: 0
+------+-----------+-----------+-----+------+------------+-------------+--------------+----------------+
| iter | benchmark | subject   | set | revs | mem_peak   | time_avg    | comp_z_value | comp_deviation |
+------+-----------+-----------+-----+------+------------+-------------+--------------+----------------+
| 0    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,057.302μs | -0.72σ       | -1.59%         |
| 1    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,053.900μs | -0.86σ       | -1.90%         |
| 2    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,051.952μs | -0.94σ       | -2.08%         |
| 3    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,062.180μs | -0.51σ       | -1.13%         |
| 4    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,116.234μs | +1.76σ       | +3.90%         |
| 5    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,094.810μs | +0.86σ       | +1.90%         |
| 6    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,104.362μs | +1.26σ       | +2.79%         |
| 7    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,110.690μs | +1.53σ       | +3.38%         |
| 8    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,105.174μs | +1.30σ       | +2.87%         |
| 9    | UguuBench | benchTest |     | 500  | 6,768,872b | 1,079.362μs | +0.21σ       | +0.47%         |
| 10   | UguuBench | benchTest |     | 500  | 6,768,872b | 1,056.294μs | -0.76σ       | -1.68%         |
| 11   | UguuBench | benchTest |     | 500  | 6,768,872b | 1,056.178μs | -0.77σ       | -1.69%         |
| 12   | UguuBench | benchTest |     | 500  | 6,768,872b | 1,056.820μs | -0.74σ       | -1.63%         |
| 13   | UguuBench | benchTest |     | 500  | 6,768,872b | 1,058.032μs | -0.69σ       | -1.52%         |
| 14   | UguuBench | benchTest |     | 500  | 6,768,872b | 1,051.938μs | -0.94σ       | -2.09%         |
+------+-----------+-----------+-----+------+------------+-------------+--------------+----------------+

 

Clone this wiki locally