]> git.ipfire.org Git - people/jschlag/pbs.git/commitdiff
Change default port to 7001 and start as many frontends as CPU cores are available.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Feb 2013 14:45:34 +0000 (15:45 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Feb 2013 14:49:36 +0000 (15:49 +0100)
web/__init__.py

index 7500c51ed10df43d764c1c4e6ec7223f5ec0d92a..4e24902d45bfce1dfd237e5e8955fec5bbda00e4 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import logging
+import multiprocessing
 import os.path
 import tornado.httpserver
 import tornado.locale
@@ -271,18 +272,20 @@ class Application(tornado.web.Application):
                logging.debug("Caught shutdown signal")
                self.ioloop.stop()
 
-       def run(self, port=80):
+       def run(self, port=7001):
                logging.debug("Going to background")
 
                http_server = tornado.httpserver.HTTPServer(self, xheaders=True)
 
                # If we are not running in debug mode, we can actually run multiple
                # frontends to get best performance out of our service.
-               if not self.settings["debug"]:
-                       http_server.bind(port)
-                       http_server.start(num_processes=4)
-               else:
+               if self.settings.get("debug", False):
                        http_server.listen(port)
+               else:
+                       cpu_count = multiprocessing.cpu_count()
+
+                       http_server.bind(port)
+                       http_server.start(num_processes=cpu_count)
 
                # All requests should be done after 60 seconds or they will be killed.
                self.ioloop.set_blocking_log_threshold(60)