Browse Source

Merge branch '898'

James Yen 11 years ago
parent
commit
a8b19badd1
5 changed files with 17 additions and 20 deletions
  1. 1 1
      bottle/app.py
  2. 1 1
      bottle/benchmark_config
  3. 11 0
      bottle/gunicorn_conf.py
  4. 2 9
      bottle/setup.py
  5. 2 9
      bottle/setup_py3.py

+ 1 - 1
bottle/app.py

@@ -13,7 +13,7 @@ except ImportError:
     import json
     import json
 
 
 app = Bottle()
 app = Bottle()
-app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://benchmarkdbuser:benchmarkdbpass@DBHOSTNAME:3306/hello_world?charset=utf8'
+app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://benchmarkdbuser:benchmarkdbpass@localhost:3306/hello_world?charset=utf8'
 Base = declarative_base()
 Base = declarative_base()
 db_engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])
 db_engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])
 plugin = sqlalchemy.Plugin(db_engine, keyword='db', )
 plugin = sqlalchemy.Plugin(db_engine, keyword='db', )

+ 1 - 1
bottle/benchmark_config

@@ -44,7 +44,7 @@
       "os": "Linux",
       "os": "Linux",
       "database_os": "Linux",
       "database_os": "Linux",
       "display_name": "bottle-py3",
       "display_name": "bottle-py3",
-      "notes": "CPython 3.3",
+      "notes": "CPython 3.4",
       "versus": "wsgi"
       "versus": "wsgi"
     },
     },
     "pypy": {
     "pypy": {

+ 11 - 0
bottle/gunicorn_conf.py

@@ -0,0 +1,11 @@
+import multiprocessing
+
+workers = multiprocessing.cpu_count() * 3
+bind = "0.0.0.0:8080"
+worker_class = "meinheld.gmeinheld.MeinheldWorker"
+keepalive = 120
+
+def post_fork(server, worker):
+    # Disalbe access log
+    import meinheld.server
+    meinheld.server.set_access_logger(None)

+ 2 - 9
bottle/setup.py

@@ -1,10 +1,8 @@
 import subprocess
 import subprocess
 import setup_util
 import setup_util
-import multiprocessing
 import os
 import os
 
 
 bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
 bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
-NCPU = multiprocessing.cpu_count()
 
 
 proc = None
 proc = None
 
 
@@ -12,13 +10,8 @@ proc = None
 def start(args, logfile, errfile):
 def start(args, logfile, errfile):
     global proc
     global proc
     setup_util.replace_text("bottle/app.py", "DBHOSTNAME", args.database_host)
     setup_util.replace_text("bottle/app.py", "DBHOSTNAME", args.database_host)
-    proc = subprocess.Popen([
-        bin_dir + "/gunicorn",
-        "app:app",
-        "-k", "meinheld.gmeinheld.MeinheldWorker",
-        "-b", "0.0.0.0:8080",
-        '-w', str(NCPU*3),
-        "--log-level=critical"],
+    proc = subprocess.Popen(
+        [bin_dir + "/gunicorn", "-c", "gunicorn_conf.py", "app:app"],
         cwd="bottle", stderr=errfile, stdout=logfile)
         cwd="bottle", stderr=errfile, stdout=logfile)
     return 0
     return 0
 
 

+ 2 - 9
bottle/setup_py3.py

@@ -1,10 +1,8 @@
 import subprocess
 import subprocess
 import setup_util
 import setup_util
-import multiprocessing
 import os
 import os
 
 
 bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py3/bin')
 bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py3/bin')
-NCPU = multiprocessing.cpu_count()
 
 
 proc = None
 proc = None
 
 
@@ -12,13 +10,8 @@ proc = None
 def start(args, logfile, errfile):
 def start(args, logfile, errfile):
     global proc
     global proc
     setup_util.replace_text("bottle/app.py", "DBHOSTNAME", args.database_host)
     setup_util.replace_text("bottle/app.py", "DBHOSTNAME", args.database_host)
-    proc = subprocess.Popen([
-        bin_dir + "/gunicorn",
-        "app:app",
-        "-k", "meinheld.gmeinheld.MeinheldWorker",
-        "-b", "0.0.0.0:8080",
-        '-w', str(NCPU*3),
-        "--log-level=critical"],
+    proc = subprocess.Popen(
+        [bin_dir + "/gunicorn", "-c", "gunicorn_conf.py", "app:app"],
         cwd="bottle", stderr=errfile, stdout=logfile)
         cwd="bottle", stderr=errfile, stdout=logfile)
     return 0
     return 0