Browse Source

Improved CPU utilization of the jester benchmark.

Dominik Picheta 12 years ago
parent
commit
bc3c462814
3 changed files with 16 additions and 4 deletions
  1. 12 1
      jester/config/nginx.conf
  2. 2 2
      jester/hello.nim
  3. 2 1
      jester/setup.py

+ 12 - 1
jester/config/nginx.conf

@@ -32,6 +32,17 @@ http {
   # click tracking!
   access_log /tmp/nginx.access.log combined;
 
+  upstream nimrod {
+    server localhost:9000;
+    server localhost:9001;
+    server localhost:9002;
+    server localhost:9003;
+    server localhost:9004;
+    server localhost:9005;
+    server localhost:9006;
+    server localhost:9007;
+  }
+
   server {
     # enable one of the following if you're on Linux or FreeBSD
     listen 8080 default deferred; # for Linux
@@ -59,7 +70,7 @@ http {
 
     location / {
       include /usr/local/nginx/conf/scgi_params;
-      scgi_pass localhost:9000;
+      scgi_pass nimrod;
     }
 
   }

+ 2 - 2
jester/hello.nim

@@ -1,9 +1,9 @@
-import jester, strtabs, json, asyncio, sockets
+import jester, strtabs, json, asyncio, sockets, os, strutils
 
 get "/json":
   var obj = %{"message": %"Hello, World!"}
   resp($obj, "application/json")
 
 var disp = newDispatcher()
-disp.register(port = TPort(9000), http=false)
+disp.register(port = TPort(paramStr(1).parseInt), http=false)
 while disp.poll(): nil

+ 2 - 1
jester/setup.py

@@ -10,7 +10,8 @@ def start(args):
   subprocess.check_call("nimrod c -d:release --path:../installs/jester/jester hello.nim", shell=True, cwd="jester")
   subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/jester/config/nginx.conf", shell=True)
   
-  subprocess.Popen("./hello > /dev/null", shell=True, cwd="jester")
+  for i in range(0, 8):
+    subprocess.Popen("./hello 900" + i + " > /dev/null", shell=True, cwd="jester")
   return 0
 
 def stop():