See the internet says Nodejs processing concurrent Requests is fast. Compare PyPy + Twisted single-threaded model
Pypy+twisted Victory Nodejs at least twice times faster than Nodejs
Nodejs results:
Benchmarking 127.0.0.1 (Be patient)
Completed 4000 requests
Completed 8000 requests
Completed 12000 requests
Completed 16000 requests
Completed 20000 requests
Completed 24000 requests
Completed 28000 Requests
Completed 32000 requests
Completed 36000 requests
Completed 40000 requests
Finished 40000 requests
Server Software:
Server hostname:127.0.0.1benchmarking 127.0.0.1 (Be patient)
Completed 4000 requests
Completed 8000 requests
Completed 12000 requests
Completed 16000 requests
Completed 20000 requests
Completed 24000 requests
Completed 28000 Requests
Completed 32000 requests
Completed 36000 requests
Completed 40000 requests
Finished 40000 requests
Server Software:
Server hostname:127.0.0.1
Server port:8080
Document Path:/
Document length:12 bytes
Concurrency level:10000
Time taken for tests:3.465 seconds
Complete requests:40000
Failed requests:0
Total transferred:2280000 bytes
HTML transferred:480000 bytes
Requests per second:11543.84 [#/sec] (mean)
Time per request:866.263 [MS] (mean)
Time per request:0.087 [MS] (mean, across all concurrent requests)
Transfer rate:642.58 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 200 350.6 7 1026
Processing:4 105 170.3 12 1658
Waiting:2 101 167.4 10 1658
Total:5 304 427.1 20 2677
Percentage of the requests served within a certain time (MS)
50% 20
66% 446
75% 461
80% 518
90% 1029
95% 1064
98% 1418
99% 1811
100% 2677 (Longest request)
Server port:8888
Document Path:/
Document length:11 bytes
Concurrency level:10000
Time taken for tests:6.965 seconds
Complete requests:40000
Failed requests:0
Total transferred:4480000 bytes
HTML transferred:440000 bytes
Requests per second:5742.94 [#/sec] (mean)
Time per request:1741.267 [MS] (mean)
Time per request:0.174 [MS] (mean, across all concurrent requests)
Transfer rate:628.13 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 713 968.6 200 3010
processing:19 121 200.9 47 3277
waiting:19 121 200.9 47 3277
total:22 834 987.6 676 6283
Percentage of the requests served within a certain time (MS)
50% 676
66% 1046
75% 1054
80% 1173
90% 3047
95% 3059
98% 3090
99% 3248
100% 6283 (Longest request)
PyPy + Twisted
Benchmarking 127.0.0.1 (Be patient)
Completed 4000 requests
Completed 8000 requests
Completed 12000 requests
Completed 16000 requests
Completed 20000 requests
Completed 24000 requests
Completed 28000 Requests
Completed 32000 requests
Completed 36000 requests
Completed 40000 requests
Finished 40000 requests
Server Software:
Server hostname:127.0.0.1
Server port:8080
Document Path:/
Document length:12 bytes
Concurrency level:10000
Time taken for tests:3.465 seconds
Complete requests:40000
Failed requests:0
Total transferred:2280000 bytes
HTML transferred:480000 bytes
Requests per second:11543.84 [#/sec] (mean)
Time per request:866.263 [MS] (mean)
Time per request:0.087 [MS] (mean, across all concurrent requests)
Transfer rate:642.58 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 200 350.6 7 1026
Processing:4 105 170.3 12 1658
Waiting:2 101 167.4 10 1658
Total:5 304 427.1 20 2677
Percentage of the requests served within a certain time (MS)
50% 20
66% 446
75% 461
80% 518
90% 1029
95% 1064
98% 1418
99% 1811
100% 2677 (Longest request)
Nodejs Code:
var http = require ("http");
Http.createserver (function (request, response) {
Response.writehead ($, {"Content-type": "Text/plain"});
Response.Write ("Hello World");
Response.End ();
}). Listen (8888);
Twisted Code:
Import Sys
From twisted.internet import Epollreactor
Epollreactor.install ();
From twisted.internet Import reactor
From Twisted.web Import http
Class Myrequesthandler (HTTP. Request):
pages={
'/': ' Hello world! ',
'/test ': ' }
def process (self):
If Self.pages.has_key (Self.path):
Self.setheader ("Content-type", "Text/plain")
Self.write (Self.pages[self.path])
Else
Self.setresponsecode (http. Not_found)
Self.write ("Self.finish ()
Class Myhttp (HTTP. HTTPChannel):
Requestfactory=myrequesthandler
Class Myhttpfactory (HTTP. Httpfactory):
Protocol=myhttp
If __name__== "__main__":
Reactor.listentcp (8080,myhttpfactory ())
Reactor.run ()
PyPy with Twisted vs Nodejs