Browse Source

Updates Jester and HttpBeast. (#3933)

* Updates Jester and HttpBeast.

* Updates Jester readme.
Dominik Picheta 7 years ago
parent
commit
4ffd6c093c

+ 1 - 1
frameworks/Nim/httpbeast/techempower.nimble

@@ -11,4 +11,4 @@ skipExt = @["nim"]
 # Dependencies
 
 requires "nim >= 0.18.0"
-requires "httpbeast#95a753b99d0059"
+requires "httpbeast#995fe86443d4a0"

+ 10 - 12
frameworks/Nim/jester/README.md

@@ -1,20 +1,18 @@
-# Nimrod Jester Benchmarking Test
+# Nim Jester Benchmarking Test
 
-This is the Nimrod jester portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+This is the Nim jester portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
 
-### JSON Encoding Test
-* [JSON test source](hello.nim)
+## Important Libraries
 
-
-## Infrastructure Software Versions
 The tests were run with:
-* [Nimrod 0.9.2](http://www.nimrod-code.org/)
-* [Jester a7914d5](https://github.com/dom96/jester/commit/a7914d5ab918debec24343286b3939ccd3c4619d)
-* Nginx 1.4.1
+
+* [Jester](https://github.com/dom96/jester)
 
 ## Test URLs
+### JSON
+
+http://localhost:8080/json
 
-### JSON Encoding Test
+### PLAINTEXT
 
-Nimrod:
-localhost:8080/json
+http://localhost:8080/plaintext

+ 22 - 18
frameworks/Nim/jester/benchmark_config.json

@@ -1,22 +1,26 @@
 {
   "framework": "jester",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MySQL",
-      "framework": "jester",
-      "language": "Nim",
-      "orm": "Raw",
-      "platform": "None",
-      "webserver": "nginx",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "jester",
-      "notes": "",
-      "versus": ""
+  "tests": [
+    {
+      "default": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "database": "None",
+        "framework": "jester",
+        "language": "Nim",
+        "flavor": "None",
+        "orm": "None",
+        "platform": "None",
+        "webserver": "None",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "Jester",
+        "notes": "",
+        "versus": "httpbeast"
+      }
     }
-  }]
+  ]
 }

+ 0 - 80
frameworks/Nim/jester/config/nginx.conf

@@ -1,80 +0,0 @@
-# Config file based on sinatra's.
-
-# you generally only need one nginx worker unless you're serving
-# large amounts of static files which require blocking disk reads
-worker_processes 8;
-
-# # drop privileges, root is needed on most systems for binding to port 80
-# # (or anything < 1024).  Capability-based security may be available for
-# # your system and worth checking out so you won't need to be root to
-# # start nginx to bind on 80
-# user nobody nogroup; # for systems with a "nogroup"
-#user nobody nobody; # for systems with "nobody" as a group instead
-
-# Feel free to change all paths to suite your needs here, of course
-# pid /tmp/nginx.pid;
-#error_log /tmp/nginx.error.log;
-error_log stderr error;
-
-events {
-  worker_connections 4096; # increase if you have lots of clients
-  accept_mutex off; # "on" if nginx worker_processes > 1
-  use epoll; # enable for Linux 2.6+
-  # use kqueue; # enable for FreeBSD, OSX
-}
-
-http {
-  # nginx will find this file in the config directory set at nginx build time
-  #include /usr/local/nginx/conf/mime.types;
-
-  # fallback in case we can't determine a type
-  default_type application/octet-stream;
-
-  # click tracking!
-  #access_log /tmp/nginx.access.log combined;
-  access_log off;
-
-  upstream nimrod {
-    server 127.0.0.1:9000;
-    server 127.0.0.1:9001;
-    server 127.0.0.1:9002;
-    server 127.0.0.1:9003;
-    server 127.0.0.1:9004;
-    server 127.0.0.1:9005;
-    server 127.0.0.1:9006;
-    server 127.0.0.1:9007;
-  }
-
-  server {
-    # enable one of the following if you're on Linux or FreeBSD
-    listen 8080 default deferred; # for Linux
-    # listen 80 default accept_filter=httpready; # for FreeBSD
-
-    client_max_body_size 4G;
-    server_name _;
-
-    # ~2 seconds is often enough for most folks to parse HTML/CSS and
-    # retrieve needed images/icons/frames, connections are cheap in
-    # nginx so increasing this is generally safe...
-    keepalive_timeout 10;
-
-    # path for static files
-    root /path/to/app/current/public;
-
-    # Prefer to serve static files directly from nginx to avoid unnecessary
-    # data copies from the application server.
-    #
-    # try_files directive appeared in in nginx 0.7.27 and has stabilized
-    # over time.  Older versions of nginx (e.g. 0.6.x) requires
-    # "if (!-f $request_filename)" which was less efficient:
-    # http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
-    #try_files $uri/index.html $uri.html $uri @app;
-
-    location / {
-      #include /usr/local/nginx/conf/scgi_params;
-      #scgi_pass nimrod;
-      proxy_pass http://nimrod;
-    }
-
-  }
-}

+ 0 - 11
frameworks/Nim/jester/hello.nim

@@ -1,11 +0,0 @@
-import jester, strtabs, json, asyncdispatch, os, strutils
-
-let port = Port(paramStr(1).parseInt)
-let settings = newSettings(port=port)
-
-routes:
-  get "/json":
-    var obj = %{"message": %"Hello, World!"}
-    resp($obj, "application/json")
-
-runForever()

+ 11 - 14
frameworks/Nim/jester/jester.dockerfile

@@ -1,18 +1,15 @@
-FROM nimlang/nim:0.16.0
+FROM gcc:latest
 
-RUN apt update -yqq && apt install -yqq nginx
+RUN apt update && apt install -y libgc-dev
 
-# 2016-10-01
-RUN git clone https://github.com/dom96/jester.git && \
-    cd jester && \
-    git checkout 22f6ce61924a8f4d170c54f1a6709f898085deb4 && \
-    nimble update && \
-    echo 'y' | nimble install
+ENV CHOOSENIM_NO_ANALYTICS 1
+ENV CHOOSENIM_CHOOSE_VERSION #0c683d28bbd5
+RUN curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y
+ENV PATH $PATH:/root/.nimble/bin
 
-ENV JESTER_HOME=/jester
+ADD ./ /jester
+WORKDIR /jester
+RUN nimble install -y httpbeast@#995fe86443d4a0
+RUN nimble c -d:release --threads:on --gc:boehm -y techempower.nim
 
-COPY ./ ./
-
-RUN chmod a+wrx start-servers.sh
-
-CMD ./start-servers.sh
+CMD ./techempower

+ 0 - 13
frameworks/Nim/jester/start-servers.sh

@@ -1,13 +0,0 @@
-#!/bin/bash
-
-nim c -d:release hello.nim
-nginx -c /config/nginx.conf
-
-current=9000
-end=9008
-while [ $current -lt $end ]; do
-  ./hello $current &
-  let current=current+1
-done
-
-wait

+ 15 - 0
frameworks/Nim/jester/techempower.nim

@@ -0,0 +1,15 @@
+import json
+
+import jester
+
+settings:
+  port = Port(8080)
+
+routes:
+  get "/json":
+    const data = $(%*{"message": "Hello, World!"})
+    resp data, "application/json"
+
+  get "/plaintext":
+    const data = "Hello, World!"
+    resp data, "text/plain"

+ 14 - 0
frameworks/Nim/jester/techempower.nimble

@@ -0,0 +1,14 @@
+# Package
+
+version       = "0.1.0"
+author        = "Dominik Picheta"
+description   = "TechEmpower Jester benchmark."
+license       = "MIT"
+
+bin           = @["techempower"]
+skipExt = @["nim"]
+
+# Dependencies
+
+requires "nim >= 0.18.0"
+requires "jester#97f6cbc76dfd8"