Tornado cherrypy bottle performance test

Source: Internet
Author: User

2011-11-25

Today we made a comparison between tornado cherrypy and bottle.

AB-n 10000-c 1000 http: // 192.168.8.2: 8889/1588 req/s (tornado)
AB-n 10000-c 1000 http: // 192.168.8.2: 9080/hello/shengp 323.35 req/s (bottle)
AB-n 10000-c 1000 http: // 192.168.8.2: 8088/nqsdk/change 452.36 req/s (cherrypy)

It is found that there is a big gap with the 3000 + tested by others

I am very excited to post messages in CPyUG that have been included in the woodpecker community.

Link: http://wiki.woodpecker.org.cn/moin/MiscItems/2011-11-25

Indexed articles

Symptom

Dean forever deanforwever2010@gmail.com
Sender's local time: the sending time is (GMT + ). Current sending time: PM. Bytes
Topic: [CPyUG] When I test tornado performance, when I add concurrency to 2000, an error occurs?

The dual-core 2.0 Ghz debian system runs tornado's hello world:

Switch row number display
Import tornado. httpserver
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 __":
Http_server = tornado. httpserver. HTTPServer (application)
Http_server.listen (1081)
Tornado. ioloop. IOLoop. instance (). start ()

AB-n 10000-c 1000 http: // 192.168.8.2: 8889/concurrency can reach 1588req/s

Run AB-n 10000-c 2000 http: // 192.168.8.2: 1081/error:
Traceback (most recent call last ):
File "/usr/local/lib/python2.6/site-packages/tornado-1.2.1-py2.6.egg/tornado/ioloop. py ",
Line 269, in start
File "/usr/local/lib/python2.6/site-packages/tornado-1.2.1-py2.6.egg/tornado/stack_context.py ",
Line 173, in wrapped
File "/usr/local/lib/python2.6/site-packages/tornado-1.2.1-py2.6.egg/tornado/httpserver. py ",
Line 238, in _ handle_events
File "/usr/local/lib/python2.6/socket. py", line 195, in accept
Error: [Errno 24] Too Temporary open files

The performance of running AB on another 8-core 8 GB memory server has not been significantly improved, and an error occurs when the concurrency is increased to 2000:
Traceback (most recent call last ):
File "/usr/local/python/lib/python2.6/site-packages/tornado-2.1.1-py2.6.egg/tornado/ioloop. py ",
Line 309, in start
File "/usr/local/python/lib/python2.6/site-packages/tornado-2.1.1-py2.6.egg/tornado/netutil. py ",
Line 314, in accept_handler
File "/usr/local/python/lib/python2.6/socket. py", line 195, in accept
Error: [Errno 24] Too Temporary open files

Could you tell me if my testing method is wrong? Why can't I see the 3000 + concurrent effects written by other experts?

Built-in support

WooParadog guohaochuan@gmail.com
Sender's local time: the sending time is (GMT + ). Current sending time: PM. Bytes

I flipped through and found that tornado comes with something parallel... the usage is as follows .. on my machine (Dell i5/4G), we can run to 5790.15 [#/sec] (mean). If we don't need to use it, we can run to 2726.08 [#/sec] (mean ).. well, fake quad-core laptop...

Switch row number display
#! /Usr/bin/env python
#-*-Coding: UTF-8 -*-
'''
Tor. py
Author: WooParadog
Email: Guohaochuan@gmail.com

Created on
2011-11-25
'''

Import tornado
Import tornado. process
Import tornado. web
From tornado import httpserver
From tornado import ioloop
From tornado. web import RequestHandler

Class non (RequestHandler ):
Def get (self ):
"Docstring for get """
Self. write ("hello ")

Def main ():
"Docstring for main """
Sokets = tornado. netutil. bind_sockets (8080)
Tornado. process. fork_processes (0)
Application = tornado. web. Application ([
('', Non)])
Http_server = httpserver. HTTPServer (application)
Http_server.add_sockets (sokets)
Ioloop. IOLoop. instance (). start ()

If _ name _ = '_ main __':
Main ()

Daniel, you are the most useful!
AB-n 10000-c 1000 http: // 192.168.0.36: 1081/
...
Requests per secondd: 8416.98 [#/sec] (mean)

Concurrency up to 5000 can reach req/s. It seems that I am not using it.

Feilong Analysis

Felw.lee felinx.lee@gmail.com
Sender's local time: the sending time is (GMT + ). Current sending time: PM. Bytes
This is the fd limit allowed by the system. You can refer to this

Http://thedaneshproject.com/posts/how-to-increase-total-file-descriptors-count-on-linux/
The fd limit of each process is restricted. For details, refer:

Http://stackoverflow.com/questions/2569620/socket-accept-error-24-to-many-open-files
When fork is used, multiple processes are run based on multiple cores. The limits of each process have not been met, so no error is made. However, fork is not recommended for tornado.

Finally, the WooParadog method is better developed to over (on an 8-core system)

I followed the recommendation article of feilong and found that wood works and I don't know if it is a machine problem...

Running Error 404 error http: // 192.168.0.36: 1081 remove the slash. Running error:

Requests per secondd: 11187.92 [#/sec] (mean)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.