Skip to content

Instantly share code, notes, and snippets.

@Snawoot
Last active February 8, 2023 21:12
Show Gist options
  • Save Snawoot/2de3b4f542bd6dfaebf4 to your computer and use it in GitHub Desktop.
Save Snawoot/2de3b4f542bd6dfaebf4 to your computer and use it in GitHub Desktop.
Tornado PyPy vs CPython benchmark

Tornado: pypy vs CPython benchmark

Test box

Centos 7, Tornado 2.2.1

CPython case:

Python 2.7.5

PyPy case:

PyPy 2.2.1

Note:

During this test CPython-driven tornado had connection drops:

apr_socket_recv: Connection reset by peer (104)
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
Server Software: TornadoServer/2.2.1
Server Hostname: localhost
Server Port: 8888
Document Path: /
Document Length: 12 bytes
Concurrency Level: 1000
Time taken for tests: 11.765 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 8500000 bytes
HTML transferred: 600000 bytes
Requests per second: 4249.85 [#/sec] (mean)
Time per request: 235.302 [ms] (mean)
Time per request: 0.235 [ms] (mean, across all concurrent requests)
Transfer rate: 705.54 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 151 661.6 0 7019
Processing: 4 35 38.1 30 1858
Waiting: 4 35 38.1 30 1858
Total: 9 186 670.1 30 7879
Percentage of the requests served within a certain time (ms)
50% 30
66% 34
75% 36
80% 38
90% 101
95% 1037
98% 1255
99% 3041
100% 7879 (longest request)
Server Software: TornadoServer/2.2.1
Server Hostname: localhost
Server Port: 8888
Document Path: /
Document Length: 12 bytes
Concurrency Level: 1000
Time taken for tests: 4.810 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 8500000 bytes
HTML transferred: 600000 bytes
Requests per second: 10395.52 [#/sec] (mean)
Time per request: 96.195 [ms] (mean)
Time per request: 0.096 [ms] (mean, across all concurrent requests)
Transfer rate: 1725.82 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 62 324.1 0 3009
Processing: 4 19 67.5 8 1705
Waiting: 4 19 67.5 8 1705
Total: 5 80 356.7 9 3841
Percentage of the requests served within a certain time (ms)
50% 9
66% 10
75% 13
80% 16
90% 39
95% 122
98% 1034
99% 1861
100% 3841 (longest request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment