Browse Source

Add Lwan tests.

This patch adds Lwan web server alongside a benchmark that implements
all but one (database updates) tests.
Leandro Pereira 11 years ago
parent
commit
cb06c4590a

+ 1 - 0
.travis.yml

@@ -24,6 +24,7 @@ env:
     #   find . -type d -depth 2 | sed 's|./|    - "TESTDIR=|' | sed 's/$/"/g'
     #   find . -type d -depth 2 | sed 's|./|    - "TESTDIR=|' | sed 's/$/"/g'
     #
     #
     #  
     #  
+    - "TESTDIR=C/lwan"
     - "TESTDIR=C/duda"
     - "TESTDIR=C/duda"
     - "TESTDIR=C/onion"
     - "TESTDIR=C/onion"
     - "TESTDIR=C#/aspnet"
     - "TESTDIR=C#/aspnet"

+ 35 - 0
frameworks/C/lwan/README.md

@@ -0,0 +1,35 @@
+# Lwan
+
+This is the configuration files to benchmark the [Lwan](http://lwan.ws)
+web server/framework.
+
+## Requirements
+
+GCC, SQLite 3.7, Linux 3.0, optionally jemalloc or tcmalloc.
+
+## Tests available
+
+### 1. JSON serialization
+
+URL: /json
+
+### 2. Single database query
+
+URL: /db
+
+### 3. Multiple database queries
+
+URL: /queries?queries=N
+
+### 4. Fortunes
+
+URL: /fortunes
+
+### 6. Plaintext
+
+URL: /plaintext
+
+
+## Contact
+
+Leandro Pereira <[email protected]>

+ 0 - 0
frameworks/C/lwan/__init__.py


+ 4 - 0
frameworks/C/lwan/bash_profile.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+export LWAN_ROOT=${IROOT}/lwan
+export LWAN_BUILD=${LWAN_ROOT}/build

+ 27 - 0
frameworks/C/lwan/benchmark_config

@@ -0,0 +1,27 @@
+{
+  "framework": "lwan",
+  "tests": [{
+    "raw": {
+      "setup_file": "setup",
+      "db_url": "/db",
+      "query_url": "/queries?queries=",
+      "fortune_url": "/fortunes",
+      "plaintext_url": "/plaintext",
+      "json_url": "/json",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "SQLite",
+      "framework": "lwan",
+      "language": "C",
+      "orm": "Raw",
+      "platform": "Lwan",
+      "webserver": "Lwan",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Lwan",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}

+ 19 - 0
frameworks/C/lwan/install.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+
+REV='aa6c15fbdf63d9db722ddc72bd736b23381331be'
+
+INSTALLED_FILE="${IROOT}/lwan-${REV}.installed"
+RETCODE=$(fw_exists ${INSTALLED_FILE})
+[ ! "$RETCODE" == 0 ] || { return 0; }
+
+# Lwan is only built during installation as a dependency sanity check.
+sudo apt-get update && \
+	sudo apt-get install libjemalloc-dev && \
+	git clone git://github.com/lpereira/lwan.git && \
+        cd lwan && \
+        git checkout ${REV} && \
+        mkdir build && \
+        cd build && \
+        cmake .. -DCMAKE_BUILD_TYPE=Release && \
+        make techempower && \
+        touch ${INSTALLED_FILE}

+ 23 - 0
frameworks/C/lwan/setup.py

@@ -0,0 +1,23 @@
+import subprocess
+import sys
+import os
+
+def start(args, logfile, errfile):
+  subprocess.call('rm -rf ${LWAN_BUILD}', shell=True, stderr=errfile, stdout=logfile)
+  subprocess.call('mkdir -p ${LWAN_BUILD}', shell=True, stderr=errfile, stdout=logfile)
+  subprocess.call('cmake ${LWAN_ROOT} -DCMAKE_BUILD_TYPE=Release && make techempower',
+      cwd=os.environ['LWAN_BUILD'], shell=True, stderr=errfile, stdout=logfile)
+
+  db_dir = os.path.join(os.environ['LWAN_ROOT'], 'techempower')
+  exe_path = os.path.join(os.environ['LWAN_BUILD'], 'techempower', 'techempower')
+  subprocess.Popen(exe_path, cwd=db_dir, stderr=errfile, stdout=logfile, shell=True)
+
+  return 0
+
+def stop(logfile, errfile):
+  p = subprocess.Popen(['pgrep', 'techempower'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+      pid = int(line)
+      os.kill(pid, 2)
+  return 0