Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################################################################
- Node cluster:
- Node version: v0.10.25
- Code:
- var http = require('http');
- var mysql = require('mysql2');
- var async = require('async');
- var connection = mysql.createConnection({ user: 'benchmark', database: 'benchmark', password: 'benchpass'});
- var cluster = require('cluster');
- var numCPUs = require('os').cpus().length;
- if (cluster.isMaster) {
- // Fork workers.
- for (var i = 0; i < numCPUs; i++) {
- cluster.fork();
- }
- cluster.on('exit', function (worker, code, signal) {
- console.log('worker ' + worker.process.pid + ' died');
- });
- } else {
- http.createServer(function (req, res) {
- res.writeHead(200, {'Content-Type': 'text/html'});
- connection.query('SELECT * FROM users;', function (err, rows) {
- if (err) {
- throw new SQLException('Connection failed: ' + err);
- }
- var table = '<table><tr><th>id</th><th>username</th><th>password</th><th>banking account</th><th>phone number</th></tr>';
- async.forEach(rows, function (row, callback) {
- table += '<tr><td>' + row.id + '</td><td>' + row.username + '</td><td>' + row.password + '</td><td>' + row.banking_account + '</td><td>' + row.phone_number + '</td></tr>';
- callback();
- }, function (err) {
- if (err) {
- throw new Error('Async failed! ' + err);
- }
- table += '</table>';
- table += '<div style="color:red">Hello from cluster worker: ' + cluster.worker.id + '</div>';
- res.end(table);
- });
- });
- }).listen(9615);
- console.log("Server running at http://localhost:9615 on cluster worker number " + cluster.worker.id);
- }
- Run command:
- /srv/node/benchmark-node-cluster$ NODE_DEBUG=cluster node index.js
- 20280,Master Worker 20286 online
- 20280,Master Worker 20287 online
- 20280,Master Worker 20289 online
- 20280,Master Worker 20290 online
- Server running at http://localhost:9615 on cluster worker number 1
- Server running at http://localhost:9615 on cluster worker number 2
- Server running at http://localhost:9615 on cluster worker number 3
- Server running at http://localhost:9615 on cluster worker number 4
- Benchmark:
- ab -n 100000 -c 200 http://127.0.0.1:9615/
- This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
- Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
- Licensed to The Apache Software Foundation, http://www.apache.org/
- Benchmarking 127.0.0.1 (be patient)
- Completed 10000 requests
- Completed 20000 requests
- Completed 30000 requests
- Completed 40000 requests
- Completed 50000 requests
- Completed 60000 requests
- Completed 70000 requests
- Completed 80000 requests
- Completed 90000 requests
- Completed 100000 requests
- Finished 100000 requests
- Server Software:
- Server Hostname: 127.0.0.1
- Server Port: 9615
- Document Path: /
- Document Length: 11001 bytes
- Concurrency Level: 200
- Time taken for tests: 11.692 seconds
- Complete requests: 100000
- Failed requests: 0
- Total transferred: 1110100000 bytes
- HTML transferred: 1100100000 bytes
- Requests per second: 8553.03 [#/sec] (mean)
- Time per request: 23.384 [ms] (mean)
- Time per request: 0.117 [ms] (mean, across all concurrent requests)
- Transfer rate: 92721.84 [Kbytes/sec] received
- Connection Times (ms)
- min mean[+/-sd] median max
- Connect: 0 0 0.1 0 3
- Processing: 0 23 16.8 20 113
- Waiting: 0 23 16.8 20 113
- Total: 0 23 16.8 20 113
- Percentage of the requests served within a certain time (ms)
- 50% 20
- 66% 28
- 75% 34
- 80% 37
- 90% 45
- 95% 52
- 98% 63
- 99% 80
- 100% 113 (longest request)
- ##########################################################################
- JXCore multithreaded
- JXCore version: JXcore Beta 2.3.2
- Code:
- var http = require('http');
- var mysql = require('mysql2');
- var async = require('async');
- var connection = mysql.createConnection({ user: 'benchmark', database: 'benchmark', password: 'benchpass'});
- http.createServer(function (req, res) {
- res.writeHead(200, {'Content-Type': 'text/html'});
- connection.query('SELECT * FROM users;', function (err, rows) {
- if (err) {
- throw new SQLException('Connection failed: ' + err);
- }
- var table = '<table><tr><th>id</th><th>username</th><th>password</th><th>banking account</th><th>phone number</th></tr>';
- async.forEach(rows, function (row, callback) {
- table += '<tr><td>' + row.id + '</td><td>' + row.username + '</td><td>' + row.password + '</td><td>' + row.banking_account + '</td><td>' + row.phone_number + '</td></tr>';
- callback();
- }, function (err) {
- if (err) {
- throw new Error('Async failed! ' + err);
- }
- table += '</table>';
- table += '<div style="color:red">Hello from jxcore thread: ' + process.threadId + '</div>';
- res.end(table);
- });
- });
- }).listen(9615);
- console.log("Server running at http://localhost:9615 on thread number " + process.threadId);
- Run command:
- /srv/node/benchmark-jxcore$ jx mt-keep:4 index.js
- Server running at http://localhost:9615 on thread number 0
- Server running at http://localhost:9615 on thread number 1
- Server running at http://localhost:9615 on thread number 2
- Server running at http://localhost:9615 on thread number 3
- Benchmark:
- ab -n 100000 -c 200 http://127.0.0.1:9615/
- This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
- Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
- Licensed to The Apache Software Foundation, http://www.apache.org/
- Benchmarking 127.0.0.1 (be patient)
- Completed 10000 requests
- Completed 20000 requests
- Completed 30000 requests
- Completed 40000 requests
- Completed 50000 requests
- Completed 60000 requests
- Completed 70000 requests
- Completed 80000 requests
- Completed 90000 requests
- Completed 100000 requests
- Finished 100000 requests
- Server Software:
- Server Hostname: 127.0.0.1
- Server Port: 9615
- Document Path: /
- Document Length: 11000 bytes
- Concurrency Level: 200
- Time taken for tests: 14.994 seconds
- Complete requests: 100000
- Failed requests: 0
- Total transferred: 1110000000 bytes
- HTML transferred: 1100000000 bytes
- Requests per second: 6669.12 [#/sec] (mean)
- Time per request: 29.989 [ms] (mean)
- Time per request: 0.150 [ms] (mean, across all concurrent requests)
- Transfer rate: 72292.19 [Kbytes/sec] received
- Connection Times (ms)
- min mean[+/-sd] median max
- Connect: 0 0 20.5 0 999
- Processing: 0 30 22.8 25 234
- Waiting: 0 29 22.8 25 234
- Total: 0 30 30.7 25 1037
- Percentage of the requests served within a certain time (ms)
- 50% 25
- 66% 35
- 75% 41
- 80% 46
- 90% 60
- 95% 71
- 98% 90
- 99% 101
- 100% 1037 (longest request)
- ###########################################################################
- JXCore running Cluster code with no MT
- ab -n 100000 -c 200 http://127.0.0.1:9615/
- This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
- Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
- Licensed to The Apache Software Foundation, http://www.apache.org/
- Benchmarking 127.0.0.1 (be patient)
- Completed 10000 requests
- Completed 20000 requests
- Completed 30000 requests
- Completed 40000 requests
- Completed 50000 requests
- Completed 60000 requests
- Completed 70000 requests
- Completed 80000 requests
- Completed 90000 requests
- Completed 100000 requests
- Finished 100000 requests
- Server Software:
- Server Hostname: 127.0.0.1
- Server Port: 9615
- Document Path: /
- Document Length: 11001 bytes
- Concurrency Level: 200
- Time taken for tests: 14.254 seconds
- Complete requests: 100000
- Failed requests: 0
- Total transferred: 1110100000 bytes
- HTML transferred: 1100100000 bytes
- Requests per second: 7015.81 [#/sec] (mean)
- Time per request: 28.507 [ms] (mean)
- Time per request: 0.143 [ms] (mean, across all concurrent requests)
- Transfer rate: 76057.18 [Kbytes/sec] received
- Connection Times (ms)
- min mean[+/-sd] median max
- Connect: 0 0 18.1 0 997
- Processing: 0 28 24.5 22 171
- Waiting: 0 28 24.5 22 171
- Total: 0 28 30.6 22 1044
- Percentage of the requests served within a certain time (ms)
- 50% 22
- 66% 35
- 75% 42
- 80% 47
- 90% 59
- 95% 72
- 98% 91
- 99% 104
- 100% 1044 (longest request)
- ###########################################################################
- HHVM fastCGI + Nginx
- HHVM version:
- HipHop VM 3.2.0 (rel)
- Compiler: tags/HHVM-3.2.0-0-g01228273b8cf709aacbd3df1c51b1e690ecebac8
- Repo schema: c52ba40f4a246d35a88f1dfc1daf959851ced8aa
- Code:
- <?php
- $db = new PDO('mysql:host=localhost;dbname=benchmark', 'benchmark', 'benchpass');
- $results = $db->query('SELECT * FROM users;');
- echo '<table><tr><th>id</th><th>username</th><th>password</th><th>banking account</th><th>phone number</th></tr>';
- foreach ($results as $row) {
- echo '<tr><td>' . $row['id'] . '</td><td>' . $row['username'] . '</td><td>' . $row['password'] . '</td><td>' . $row['banking_account'] . '</td><td>' . $row['phone_number'] . '</td></tr>';
- }
- echo '</table>';
- echo '<div style="color:red">Hello from HHVM!</div>';
- Benchmark:
- ab -n 100000 -c 200 http://127.0.0.1:8080/
- This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
- Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
- Licensed to The Apache Software Foundation, http://www.apache.org/
- Benchmarking 127.0.0.1 (be patient)
- Completed 10000 requests
- Completed 20000 requests
- Completed 30000 requests
- Completed 40000 requests
- Completed 50000 requests
- Completed 60000 requests
- Completed 70000 requests
- Completed 80000 requests
- Completed 90000 requests
- Completed 100000 requests
- Finished 100000 requests
- Server Software: nginx/1.6.1
- Server Hostname: 127.0.0.1
- Server Port: 8080
- Document Path: /
- Document Length: 10989 bytes
- Concurrency Level: 200
- Time taken for tests: 16.247 seconds
- Complete requests: 100000
- Failed requests: 0
- Total transferred: 1115100000 bytes
- HTML transferred: 1098900000 bytes
- Requests per second: 6155.01 [#/sec] (mean)
- Time per request: 32.494 [ms] (mean)
- Time per request: 0.162 [ms] (mean, across all concurrent requests)
- Transfer rate: 67025.92 [Kbytes/sec] received
- Connection Times (ms)
- min mean[+/-sd] median max
- Connect: 0 5 70.4 0 1000
- Processing: 2 27 8.0 26 237
- Waiting: 2 27 8.0 26 237
- Total: 4 32 70.8 26 1036
- Percentage of the requests served within a certain time (ms)
- 50% 26
- 66% 31
- 75% 33
- 80% 33
- 90% 35
- 95% 39
- 98% 43
- 99% 48
- 100% 1036 (longest request)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement