Browse Source

Revert "Merge branch 'tornado-postgres' of https://github.com/maticz/FrameworkBenchmarks into 671"

This reverts commit 444ee4a7e650387de64f180db4ab4170a5332204, reversing
changes made to 080302766191c4ce664004b84f6a830c5fc0e210.
James Yen 11 years ago
parent
commit
99dcab20cb
4 changed files with 1 additions and 105 deletions
  1. 0 2
      toolset/setup/linux/installer.py
  2. 0 21
      tornado/benchmark_config
  3. 1 50
      tornado/server.py
  4. 0 32
      tornado/setup_pg.py

+ 0 - 2
toolset/setup/linux/installer.py

@@ -424,8 +424,6 @@ class Installer:
     easy_install('tornado==3.1', two=True, three=True, pypy=True)
     easy_install('motor==0.1.2', two=True, three=True, pypy=True)
     easy_install('pymongo==2.5.2', two=True, three=True, pypy=True)
-    easy_install('psycopg2==2.5.3', two=True, three=True, pypy=True)
-    easy_install('Momoko==1.1.3', two=True, three=True, pypy=True)
 
     # Django
     easy_install("https://www.djangoproject.com/download/1.6/tarball/", two=True, three=True, pypy=True)

+ 0 - 21
tornado/benchmark_config

@@ -22,27 +22,6 @@
       "notes": "CPython 2.7",
       "versus": ""
     },
-    "postgresql-raw": {
-      "setup_file": "setup_pg",
-      "json_url": "/json",
-      "db_url": "/dbraw",
-      "query_url": "/queriesraw?queries=",
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "Postgres",
-      "framework": "tornado",
-      "language": "Python",
-      "orm": "Raw",
-      "platform": "Tornado",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "tornado",
-      "notes": "CPython 2.7",
-      "versus": ""
-    },
     "py3": {
       "setup_file": "setup_py3",
       "json_url": "/json",

+ 1 - 50
tornado/server.py

@@ -4,7 +4,6 @@ import sys
 import json
 from random import randint
 
-import momoko
 import motor
 import tornado.ioloop
 import tornado.web
@@ -20,7 +19,6 @@ if sys.version_info[0] == 3:
 
 tornado.options.define('port', default=8888, type=int, help="Server port")
 tornado.options.define('mongo', default='localhost', type=str, help="MongoDB host")
-tornado.options.define('postgres', default=None, type=str, help="PostgreSQL host")
 
 
 class BaseHandler(tornado.web.RequestHandler):
@@ -74,54 +72,11 @@ class QueryTestHandler(BaseHandler):
         self.write(response)
 
 
-class QueryPostgresRawTestHandler(BaseHandler):
-    @gen.coroutine
-    def get(self):
-        sql = "SELECT id, randomNumber FROM World WHERE id=%s"
-
-        random_id = randint(1, 10000)
-        cursor = yield momoko.Op(
-            self.application.db.execute, sql, (random_id,)
-        )
-        row = cursor.fetchone()
-        response = json.dumps({"id": row[0], "randomNumber": row[1]})
-
-        self.set_header("Content-Type", "application/json; charset=UTF-8")
-        self.write(response)
-
-
-class MultipleQueriesPostgresRawTestHandler(BaseHandler):
-    @gen.coroutine
-    def get(self):
-        queries = self.get_argument("queries", "1")
-        try:
-            queries = int(queries.strip())
-        except ValueError:
-            queries = 1
-
-        queries = min(max(1, queries), 500)
-
-        sql = "SELECT id, randomNumber FROM World WHERE id=%s"
-
-        worlds = []
-        for i in xrange(int(queries)):
-            random_id = randint(1, 10000)
-            cursor = yield momoko.Op(
-                self.application.db.execute, sql, (random_id,)
-            )
-            row = cursor.fetchone()
-            worlds.append({"id": row[0], "randomNumber": row[1]})
-        response = json.dumps(worlds)
-        self.set_header("Content-Type", "application/json; charset=UTF-8")
-        self.write(response)
-
 application = tornado.web.Application([
     (r"/json", JsonSerializeTestHandler),
     (r"/plaintext", PlaintextHandler),
     (r"/db", DBTestHandler),
     (r"/queries", QueryTestHandler),
-    (r"/dbraw", QueryPostgresRawTestHandler),
-    (r"/queriesraw", MultipleQueriesPostgresRawTestHandler)
 ])
 
 
@@ -130,9 +85,5 @@ if __name__ == "__main__":
     server = tornado.httpserver.HTTPServer(application)
     server.bind(options.port)
     server.start(0)
-    if options.postgres:
-        dsn = "user=benchmarkdbuser password=benchmarkdbpass dbname=hello_world host=%s" % options.postgres
-        application.db = momoko.Pool(dsn, size=1)
-    else:
-        db = motor.MotorClient(options.mongo).open_sync().hello_world
+    db = motor.MotorClient(options.mongo).open_sync().hello_world
     tornado.ioloop.IOLoop.instance().start()

+ 0 - 32
tornado/setup_pg.py

@@ -1,32 +0,0 @@
-import os
-import subprocess
-import sys
-import time
-
-
-bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
-python = os.path.expanduser(os.path.join(bin_dir, 'python'))
-pip = os.path.expanduser(os.path.join(bin_dir, 'pip'))
-cwd = os.path.expanduser('~/FrameworkBenchmarks/tornado')
-
-
-def start(args, logfile, errfile):
-    subprocess.Popen(
-        python + ' server.py --port=8080 --postgres=%s --logging=error' % (args.database_host,),
-        shell=True, cwd=cwd, stderr=errfile, stdout=logfile)
-    return 0
-
-
-def stop(logfile, errfile):
-    for line in subprocess.check_output(['ps', 'aux']).splitlines():
-        if 'server.py --port=8080' in line:
-            pid = int(line.split(None, 2)[1])
-            os.kill(pid, 9)
-    return 0
-
-if __name__ == '__main__':
-    class DummyArg:
-        database_host = 'localhost'
-    start(DummyArg(), sys.stderr, sys.stderr)
-    time.sleep(1)
-    stop(sys.stderr, sys.stderr)