Skip to content

Commit a988715

Browse files
committed
Ability to check results stack by stack
1 parent 93028ee commit a988715

File tree

8 files changed

+70
-27
lines changed

8 files changed

+70
-27
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/nbproject/
2-
/output/
32
vendor/

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,16 @@ stack=docker_nginx_hhvm_3_10_1 sh benchmark.sh
204204
stack=docker_nginx_php_7_0_0 sh benchmark.sh
205205
~~~
206206

207+
### Check the results
208+
209+
To see the results graph, run the following script from outside the docker shell, from the repository root:
210+
211+
~~~
212+
bin/docker-urls.sh
213+
~~~
214+
215+
It echoes URLs, which you should open up in your browser.
216+
207217
## References
208218

209219
* [Aura](http://auraphp.com/) ([@auraphp](https://twitter.com/auraphp))

bin/docker-urls.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
DIR=`dirname $0`;
4+
5+
echo "PHP 5.6.4 Stack:";
6+
echo "http://"$(docker-machine ip default)":"$(docker-compose -f $DIR/../docker/docker-compose.yml port nginx_php_5_6_4 80 | sed 's/[0-9.]*://')
7+
echo "HHVM 3.10.1 Stack:";
8+
echo "http://"$(docker-machine ip default)":"$(docker-compose -f $DIR/../docker/docker-compose.yml port nginx_hhvm_3_10_1 80 | sed 's/[0-9.]*://')
9+
echo "PHP 7.0.0 Stack:";
10+
echo "http://"$(docker-machine ip default)":"$(docker-compose -f $DIR/../docker/docker-compose.yml port nginx_php_7_0_0 80 | sed 's/[0-9.]*://')
11+
12+
exit 0

docker/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ php_5_6_4:
1818
- ./stack/php/:/stack/php:rw
1919
ports:
2020
- "9000"
21+
environment:
22+
STACK: 'docker_nginx_php_5_6_4'
2123
working_dir: '/repo'
2224
command: "/stack/php/run-php-fpm.sh"
2325

@@ -29,6 +31,8 @@ hhvm_3_10_1:
2931
- ./stack/php/:/stack/php:rw
3032
ports:
3133
- "9000"
34+
environment:
35+
STACK: 'docker_nginx_hhvm_3_10_1'
3236
working_dir: '/repo'
3337
command: "/stack/php/run-hhvm.sh"
3438

@@ -40,6 +44,8 @@ php_7_0_0:
4044
- ./stack/php/:/stack/php:rw
4145
ports:
4246
- "9000"
47+
environment:
48+
STACK: 'docker_nginx_php_7_0_0'
4349
working_dir: '/repo'
4450
command: "/stack/php/run-php-fpm-7.sh"
4551

index.php

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

3+
$stack = getenv('STACK') ? getenv('STACK') : 'local';
4+
$host = null;
5+
switch ($stack) {
6+
case 'local':
7+
$host = 'localhost';
8+
break;
9+
default:
10+
$host = str_replace('docker_', '', $stack);
11+
break;
12+
};
13+
$output_dir = __DIR__ . '/output/' . $stack;
14+
315
Parse_Results: {
416
require __DIR__ . '/libs/parse_results.php';
5-
$results = parse_results(__DIR__ . '/output/results.hello_world.log');
17+
$results = parse_results($output_dir . '/results.hello_world.log');
618
}
719

820
Load_Theme: {
@@ -50,6 +62,7 @@
5062
<body>
5163
<h1>PHP Framework Benchmark</h1>
5264
<h2>Hello World Benchmark</h2>
65+
<h3><?php echo $stack; ?></h3>
5366
<div>
5467
<?php
5568
echo $div_rpm, $div_mem, $div_time, $div_file;
@@ -58,11 +71,11 @@
5871

5972
<ul>
6073
<?php
61-
$url_file = __DIR__ . '/output/urls.log';
74+
$url_file = $output_dir . '/urls.log';
6275
if (file_exists($url_file)) {
6376
$urls = file($url_file);
6477
foreach ($urls as $url) {
65-
$url = str_replace('127.0.0.1', $_SERVER['HTTP_HOST'], $url);
78+
$url = str_replace(['127.0.0.1', $host], $_SERVER['HTTP_HOST'], $url);
6679
echo '<li><a href="' . htmlspecialchars($url, ENT_QUOTES, 'UTF-8') .
6780
'">' . htmlspecialchars($url, ENT_QUOTES, 'UTF-8') .
6881
'</a></li>' . "\n";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!results.hello_world.log
3+
!.gitignore
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
phalcon-2.0: 774.64: 282936: 0.001357: 5
2+
ice-1.0: 680.57: 275560: 0.002463: 4
3+
tipsy-0.10: 762.23: 336568: 0.000640: 18
4+
fatfree-3.5: 365.25: 443728: 0.002854: 9
5+
slim-2.6: 761.72: 499712: 0.000745: 24
6+
ci-3.0: 97.54: 451096: 0.029233: 26
7+
nofuss-1.2: 343.89: 619496: 0.010555: 6
8+
slim-3.0: 502.51: 647744: 0.001052: 56
9+
bear-1.0: 202.53: 791424: 0.008215: 98
10+
lumen-5.1: 303.53: 750624: 0.005721: 32
11+
ze-1.0: 216.34: 822864: 0.011665: 64
12+
radar-1.0-dev: 253.12: 738608: 0.008413: 73
13+
yii-2.0: 304.98: 1399392: 0.004463: 49
14+
silex-1.3: 319.21: 733952: 0.003194: 58
15+
cygnite-1.3: 71.28: 779760: 0.026458: 70
16+
fuel-1.8-dev: 38.59: 729960: 0.116497: 55
17+
phpixie-3.2: 32.26: 1329368: 0.005880: 164
18+
aura-2.0: 110.17: 932784: 0.017762: 68
19+
cake-3.1: 92.69: 1383696: 0.016896: 84
20+
symfony-2.7: 15.94: 2735352: 0.014343: 103
21+
laravel-5.1: 79.35: 2637888: 0.054929: 38
22+
zf-2.5: 2.08: 3069536: 0.049335: 209
23+
typo3f-3.0: 0.32: 6553744: 2.795679: 272

output/results.hello_world.log

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)