Skip to content

Instantly share code, notes, and snippets.

@winks
Created July 17, 2012 12:13
Show Gist options
  • Save winks/3129093 to your computer and use it in GitHub Desktop.
Save winks/3129093 to your computer and use it in GitHub Desktop.
react
<?php
use \Can\Server;
use \Can\Server\Router;
use \Can\Server\Route;
use \Can\Server\Request;
$router = new Router(
array(
new Route(
'/hello',
function(Request $request) {
return 'Hello, World!';
}
)
)
);
$server = new Server('172.19.1.55', 4567);
$server->start($router);
<?php
require __DIR__ . '/vendor/autoload.php';
$app = new React\Espresso\Application();
$app->get('/hello', function ($request, $response) {
$response->writeHead(
200,
array('Content-Type' => 'text/html')
);
$response->end('Hello, World!');
});
$stack = new React\Espresso\Stack($app);
$stack->listen(4567, '172.19.1.55');
# siege -b -r 100 -c 200 http://172.19.1.55:4567/hello
** SIEGE 2.70
** Preparing 200 concurrent users for battle.
The server is now under siege.. done.
Transactions: 20000 hits
Availability: 100.00 %
Elapsed time: 2.04 secs
Data transferred: 0.25 MB
Response time: 0.02 secs
Transaction rate: 9803.92 trans/sec
Throughput: 0.12 MB/sec
Concurrency: 194.59
Successful transactions: 20000
Failed transactions: 0
Longest transaction: 0.09
Shortest transaction: 0.00
# siege -b -r 10 -c 1 http://172.19.1.55:4567/hello
** SIEGE 2.70
** Preparing 1 concurrent users for battle.
The server is now under siege.. done.
Transactions: 10 hits
Availability: 100.00 %
Elapsed time: 0.22 secs
Data transferred: 0.00 MB
Response time: 0.02 secs
Transaction rate: 45.45 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 0.95
Successful transactions: 10
Failed transactions: 0
Longest transaction: 0.09
Shortest transaction: 0.01
FILE: /var/log/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false.
# siege -b -r 10 -c 10 http://172.19.1.55:4567/hello
** SIEGE 2.70
** Preparing 10 concurrent users for battle.
The server is now under siege.. done.
Transactions: 100 hits
Availability: 100.00 %
Elapsed time: 2.50 secs
Data transferred: 0.00 MB
Response time: 0.24 secs
Transaction rate: 40.00 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 9.64
Successful transactions: 100
Failed transactions: 0
Longest transaction: 0.41
Shortest transaction: 0.05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment