Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Python Tornado server #4

merged 1 commit into from

2 participants


hey Eric. I've written a tornado python websocker server, which may be faster (it spawns several processes to utilize all CPUs, and it's non blocking). I haven't tested it on AWS but it does work with the test client, I'm curious to see how it performs.
to be able to run it just sudo easy_intsall tornado


Excellent, I'll run it tonight.

@ericmoritz ericmoritz merged commit 23fb15e into from

cool. you can tune how many processes it spawns, by default it detects the number of CPUs and spawns as much processes (sharing the same socket). you can change that number manually in the line tornado.process.fork_processes(None). just change None to a number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 13, 2012
  1. Added tornado python server

    dvir volk authored
This page is out of date. Refresh to see the latest.
Showing with 42 additions and 0 deletions.
  1. +42 −0 competition/
42 competition/
@@ -0,0 +1,42 @@
+import tornado.ioloop
+import tornado.options
+import tornado.web
+import tornado.websocket
+import tornado.httpserver
+import tornado.netutil
+import tornado.process
+class Application(tornado.web.Application):
+ def __init__(self):
+ handlers = [
+ (r"/", MyWebSocketHandler),
+ ]
+ tornado.web.Application.__init__(self, handlers)
+class MyWebSocketHandler(tornado.websocket.WebSocketHandler):
+ def allow_draft76(self):
+ # for iOS 5.0 Safari
+ return False
+ def open(self):
+ pass
+ def on_message(self, message):
+ self.write_message(message, binary=True)
+def main():
+ server = tornado.httpserver.HTTPServer(Application())
+ sockets = tornado.netutil.bind_sockets(8000)
+ job = tornado.process.fork_processes(None)
+ server.add_sockets(sockets)
+ tornado.ioloop.IOLoop.instance().start()
+if __name__ == "__main__":
+ main()
Something went wrong with that request. Please try again.