Created
May 10, 2012 19:45
-
-
Save sjanecki/2655405 to your computer and use it in GitHub Desktop.
node.js vs vertx.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 100 bytes or 35000bytes of random data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| var fs = require('fs'); | |
| var fileCache = null; | |
| var fileLength = null; | |
| fs.readFile("foo.html", function(err, file) { | |
| fileCache = file; // file.toString() for small files <1kb | |
| fileLength = fileCache.length; | |
| }); | |
| var server = http.createServer(function (req, res) { | |
| res.writeHead(200, {"Content-Type": "text/html", "Content-Length": fileLength}); | |
| res.end(fileCache); | |
| }); | |
| server.listen(8080, '0.0.0.0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NODE.JS - 100 bytes: | |
| siege -b -c100 -r300 http://10.177.63.174:8080/ | |
| ** SIEGE 2.70 | |
| ** Preparing 100 concurrent users for battle. | |
| The server is now under siege.. done. | |
| Transactions: 30000 hits | |
| Availability: 100.00 % | |
| Elapsed time: 4.10 secs | |
| Data transferred: 2.86 MB | |
| Response time: 0.01 secs | |
| Transaction rate: 7317.07 trans/sec | |
| Throughput: 0.70 MB/sec | |
| Concurrency: 96.94 | |
| Successful transactions: 30000 | |
| Failed transactions: 0 | |
| Longest transaction: 0.12 | |
| Shortest transaction: 0.00 | |
| ------------------------------------------------ | |
| VERTX.JS - 100 bytes: | |
| siege -b -c100 -r300 http://10.177.63.174:8080/ | |
| ** SIEGE 2.70 | |
| ** Preparing 100 concurrent users for battle. | |
| The server is now under siege.. done. | |
| Transactions: 30000 hits | |
| Availability: 100.00 % | |
| Elapsed time: 4.47 secs | |
| Data transferred: 2.86 MB | |
| Response time: 0.01 secs | |
| Transaction rate: 6711.41 trans/sec | |
| Throughput: 0.64 MB/sec | |
| Concurrency: 93.03 | |
| Successful transactions: 30000 | |
| Failed transactions: 0 | |
| Longest transaction: 0.08 | |
| Shortest transaction: 0.00 | |
| -------------------------------------------------- | |
| NODE.JS - 35000 bytes: | |
| siege -b -c100 -r300 http://10.177.63.174:8080/ | |
| ** SIEGE 2.70 | |
| ** Preparing 100 concurrent users for battle. | |
| The server is now under siege.. done. | |
| Transactions: 30000 hits | |
| Availability: 100.00 % | |
| Elapsed time: 8.16 secs | |
| Data transferred: 1001.36 MB | |
| Response time: 0.03 secs | |
| Transaction rate: 3676.47 trans/sec | |
| Throughput: 122.72 MB/sec | |
| Concurrency: 96.83 | |
| Successful transactions: 30000 | |
| Failed transactions: 0 | |
| Longest transaction: 0.17 | |
| Shortest transaction: 0.00 | |
| -------------------------------------------------- | |
| VERTX.JS - 35000 bytes: | |
| siege -b -c100 -r300 http://10.177.63.174:8080/ | |
| ** SIEGE 2.70 | |
| ** Preparing 100 concurrent users for battle. | |
| The server is now under siege.. done. | |
| Transactions: 30000 hits | |
| Availability: 100.00 % | |
| Elapsed time: 8.04 secs | |
| Data transferred: 1001.36 MB | |
| Response time: 0.02 secs | |
| Transaction rate: 3731.34 trans/sec | |
| Throughput: 124.55 MB/sec | |
| Concurrency: 90.00 | |
| Successful transactions: 30000 | |
| Failed transactions: 0 | |
| Longest transaction: 2.07 | |
| Shortest transaction: 0.00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| load('vertx.js'); | |
| var fileCache = null; | |
| var fileLength = null; | |
| vertx.fileSystem.readFile('foo.html', function(err, file) { | |
| fileCache = file; | |
| fileLength = file.length(); | |
| }); | |
| vertx.createHttpServer().requestHandler(function(req) { | |
| req.response.headers["Content-Length"] = fileLength;; | |
| req.response.headers["Content-Type"] = "text/html"; | |
| req.response.end(fileCache); | |
| }).listen(8080, '0.0.0.0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment