Skip to content

Commit 1ea131c

Browse files
committed
Update benchmark output and results
1 parent 66bdc29 commit 1ea131c

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,14 @@ See also the [streaming exec example](examples/exec-stream.php) and the [exec be
227227
The TTY mode should be set depending on whether your command needs a TTY
228228
or not. Note that toggling the TTY mode affects how/whether you can access
229229
the STDERR stream and also has a significant impact on performance for
230-
larger streams (relevant for 100 MiB and above). See also the TTY mode
231-
on the `execStart*()` call.
232-
233-
Running this benchmark on my personal (rather mediocre) VM setup reveals that
234-
the benchmark achieves a throughput of ~300 MiB/s while the (totally unfair)
235-
comparison script using the plain Docker client only yields ~100 MiB/s.
236-
Instead of me posting more details here, I encourage you to re-run the benchmark
237-
yourself and adjust it to better suite your problem domain.
230+
larger streams (relevant for hundreds of megabytes and more). See also the TTY
231+
mode on the `execStart*()` call.
232+
233+
Running the provided benchmark example on a range of systems, it suggests that
234+
this library can process several gigabytes per second and may in fact outperform
235+
the Docker client and seems to be limited only by the Docker Engine implementation.
236+
Instead of posting more details here, you're encouraged to re-run the benchmarks
237+
yourself and see for yourself.
238238
The key takeway here is: *PHP is faster than you probably thought*.
239239

240240
#### TAR streaming

examples/benchmark-exec.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<?php
22

3-
// this simple example executes a command within the given running container and
3+
// This simple example executes a command within the given running container and
44
// displays how fast it can receive its output.
5-
// expect this to be significantly faster than the (totally unfair) equivalent:
5+
//
6+
// Before starting the benchmark, you have to start a container first, such as:
7+
//
8+
// $ docker run -it --rm --name=asd busybox sh
9+
//
10+
// Expect this to be significantly faster than the (totally unfair) equivalent:
11+
//
612
// $ docker exec asd dd if=/dev/zero bs=1M count=1000 | dd of=/dev/null
713

814
use Clue\React\Docker\Client;
@@ -35,7 +41,7 @@
3541
$stream->on('close', function () use ($client, &$bytes, $start) {
3642
$time = microtime(true) - $start;
3743

38-
echo 'Received ' . $bytes . ' bytes in ' . round($time, 1) . 's => ' . round($bytes / $time / 1024 / 1024, 1) . ' MiB/s' . PHP_EOL;
44+
echo 'Received ' . $bytes . ' bytes in ' . round($time, 1) . 's => ' . round($bytes / $time / 1000000, 1) . ' MB/s' . PHP_EOL;
3945
});
4046
}, 'printf');
4147

0 commit comments

Comments
 (0)