Browse Source

Staring on plaintext test in script

Patrick Falls 12 years ago
parent
commit
fd2d29bfd9
6 changed files with 43 additions and 3 deletions
  1. 1 0
      benchmarker.py
  2. 0 0
      dart/__init__.py
  3. 34 2
      framework_test.py
  4. 7 0
      installer.py
  5. 0 0
      plack/__init__.py
  6. 1 1
      run-tests.py

+ 1 - 0
benchmarker.py

@@ -516,6 +516,7 @@ class Benchmarker:
       self.results['rawData']['query'] = dict()
       self.results['rawData']['fortune'] = dict()
       self.results['rawData']['update'] = dict()
+      self.results['rawData']['plaintext'] = dict()
     else:
       #for x in self.__gather_tests():
       #  if x.name not in self.results['frameworks']:

+ 0 - 0
dart/__init__.py


+ 34 - 2
framework_test.py

@@ -163,6 +163,16 @@ class FrameworkTest:
       self.update_url_passed = True
     except (AttributeError, subprocess.CalledProcessError) as e:
       self.update_url_passed = False
+
+    # plaintext
+    try:
+      print "VERIFYING Plaintext (" + self.plaintext_url + ") ..."
+      url = self.benchmarker.generate_url(self.plaintext_url, self.port)
+      subprocess.check_call(["curl", "-f", url])
+      print ""
+      self.plaintext_url_passed = True
+    except (AttributeError, subprocess.CalledProcessError) as e:
+      self.plaintext_url_passed = False
   ############################################################
   # End verify_urls
   ############################################################
@@ -184,6 +194,8 @@ class FrameworkTest:
         return True
       if type == 'update' and self.update_url != None:
         return True
+      if type == 'plaintext' and self.plaintext_url != None:
+        return True
     except AttributeError:
       pass
       
@@ -264,6 +276,19 @@ class FrameworkTest:
         print "Complete"
     except AttributeError:
       pass
+
+    # plaintext
+    try:
+      if self.plaintext_url_passed and (self.benchmarker.type == "all" or self.benchmarker.type == "plaintext"):
+        sys.stdout.write("BENCHMARKING Plaintext ... ") 
+        sys.stdout.flush()
+        remote_script = self.__generate_concurrency_script(self.plaintext_url, self.port)
+        self.__run_benchmark(remote_script, self.benchmarker.output_file(self.name, 'plaintext'))
+        results = self.__parse_test('plaintext')
+        self.benchmarker.report_results(framework=self, test="plaintext", results=results['results'])
+        print "Complete"
+    except AttributeError:
+      pass
   ############################################################
   # End benchmark
   ############################################################
@@ -297,6 +322,11 @@ class FrameworkTest:
     if os.path.exists(self.benchmarker.output_file(self.name, 'update')):
       results = self.__parse_test('update')
       self.benchmarker.report_results(framework=self, test="update", results=results['results'])
+
+    # Plaintext
+    if os.path.exists(self.benchmarker.output_file(self.name, 'plaintext')):
+      results = self.__parse_test('plaintext')
+      self.benchmarker.report_results(framework=self, test="plaintext", results=results['results'])
   ############################################################
   # End parse_all
   ############################################################
@@ -419,10 +449,12 @@ class FrameworkTest:
   # specifically works for the variable concurrency tests (JSON
   # and DB)
   ############################################################
-  def __generate_concurrency_script(self, url, port):
+  def __generate_concurrency_script(self, url, port, wrk_command="wrk", intervals=[]):
+    if len(intervals) == 0:
+      intervals = self.benchmarker.concurrency_levels
     return self.concurrency_template.format(max_concurrency=self.benchmarker.max_concurrency, 
       max_threads=self.benchmarker.max_threads, name=self.name, duration=self.benchmarker.duration, 
-      interval=" ".join("{}".format(item) for item in self.benchmarker.concurrency_levels), 
+      interval=" ".join("{}".format(item) for item in intervals), 
       server_host=self.benchmarker.server_host, port=port, url=url, headers=self.headers)
   ############################################################
   # End __generate_concurrency_script

+ 7 - 0
installer.py

@@ -394,6 +394,13 @@ class Installer:
     sudo cp wrk /usr/local/bin
     cd ~
 
+    git clone https://github.com/wg/wrk.git wrk-pipeline
+    cd wrk-pipeline
+    git checkout pipeline
+    make
+    sudo cp wrk /usr/local/bin/wrk-pipeline
+    cd ~
+
     ##############################
     # MongoDB
     ##############################

+ 0 - 0
plack/__init__.py


+ 1 - 1
run-tests.py

@@ -20,7 +20,7 @@ parser.add_argument('--install-software', action='store_true', help='runs the in
 parser.add_argument('--install', choices=['client', 'server', 'all'], default='all', help='Allows you to only install the server or client software')
 parser.add_argument('--test', nargs='+', help='names of tests to run')
 parser.add_argument('--exclude', nargs='+', help='names of tests to exclude')
-parser.add_argument('--type', choices=['all', 'json', 'db', 'query', 'fortune', 'update'], default='all', help='which type of test to run')
+parser.add_argument('--type', choices=['all', 'json', 'db', 'query', 'fortune', 'update', 'plaintext'], default='all', help='which type of test to run')
 parser.add_argument('-m', '--mode', choices=['benchmark', 'verify'], default='benchmark', help='verify mode will only start up the tests, curl the urls and shutdown')
 parser.add_argument('--list-tests', action='store_true', default=False, help='lists all the known tests that can run')
 parser.add_argument('--next-sort', action='store_true', default=False, help='displays the next value that can be used as a sort value')