Created
April 19, 2012 23:05
-
-
Save eden/2424775 to your computer and use it in GitHub Desktop.
twisted vs node
This file contains 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
httperf --client=0/1 --server=localhost --port=8081 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=100 --num-calls=1000 | |
Maximum connect burst length: 1 | |
Total: connections 100 requests 100000 replies 100000 test-duration 15.187 s | |
Connection rate: 6.6 conn/s (151.9 ms/conn, <=1 concurrent connections) | |
Connection time [ms]: min 139.7 avg 151.9 max 215.4 median 148.5 stddev 12.2 | |
Connection time [ms]: connect 0.2 | |
Connection length [replies/conn]: 1000.000 | |
Request rate: 6584.7 req/s (0.2 ms/req) | |
Request size [B]: 62.0 | |
Reply rate [replies/s]: min 6397.7 avg 6580.5 max 6730.7 stddev 168.9 (3 samples) | |
Reply time [ms]: response 0.2 transfer 0.0 | |
Reply size [B]: header 79.0 content 19.0 footer 2.0 (total 100.0) | |
Reply status: 1xx=0 2xx=100000 3xx=0 4xx=0 5xx=0 | |
CPU time [s]: user 2.18 system 12.78 (user 14.4% system 84.1% total 98.5%) | |
Net I/O: 1034.6 KB/s (8.5*10^6 bps) | |
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 | |
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0 |
This file contains 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 n = 0; | |
require('http').createServer(function(req, res) { | |
res.writeHead(200, 'text/plain'); | |
res.end('I am request #' + (n++) + '\n'); | |
}).listen(8081); |
This file contains 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
httperf --client=0/1 --server=localhost --port=8080 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=100 --num-calls=1000 | |
Maximum connect burst length: 1 | |
Maximum connect burst length: 1 | |
Total: connections 14 requests 13376 replies 13375 test-duration 7.809 s | |
Connection rate: 1.8 conn/s (557.8 ms/conn, <=1 concurrent connections) | |
Connection time [ms]: min 563.7 avg 583.6 max 617.2 median 577.5 stddev 15.0 | |
Connection time [ms]: connect 0.1 | |
Connection length [replies/conn]: 1028.846 | |
Request rate: 1712.8 req/s (0.6 ms/req) | |
Request size [B]: 62.0 | |
Reply rate [replies/s]: min 1703.5 avg 1703.5 max 1703.5 stddev 0.0 (1 samples) | |
Reply time [ms]: response 0.6 transfer 0.0 | |
Reply size [B]: header 129.0 content 20.0 footer 0.0 (total 149.0) | |
Reply status: 1xx=0 2xx=13375 3xx=0 4xx=0 5xx=0 | |
CPU time [s]: user 1.08 system 6.67 (user 13.9% system 85.4% total 99.3%) | |
Net I/O: 352.9 KB/s (2.9*10^6 bps) | |
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 | |
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0 |
This file contains 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
from twisted.web import server, resource | |
from twisted.internet import reactor | |
class HelloResource(resource.Resource): | |
isLeaf = True | |
numberRequests = 0 | |
def render_GET(self, request): | |
self.numberRequests += 1 | |
request.setHeader("content-type", "text/plain") | |
return "I am request #" + str(self.numberRequests) + "\n" | |
reactor.listenTCP(8080, server.Site(HelloResource())) | |
reactor.run() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment