Browse Source

fixed networking issue, added windows test case

weltermann17 11 years ago
parent
commit
ddd279b2fe

+ 23 - 0
plain/benchmark_config

@@ -23,6 +23,29 @@
       "display_name": "plain",
       "display_name": "plain",
       "notes": "",
       "notes": "",
       "versus": ""
       "versus": ""
+    },
+    "win": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "update_url": "/update?queries=",
+      "fortune_url": "/fortunes",
+      "port": 9080,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "MySQL",
+      "framework": "plain",
+      "language": "Scala",
+      "orm": "Full",
+      "platform": "Plain",
+      "webserver": "None",
+      "os": "Windows",
+      "database_os": "Linux",
+      "display_name": "plain-win",
+      "notes": "",
+      "versus": ""
     }
     }
   }]
   }]
 }
 }

+ 2 - 2
plain/build.sbt

@@ -31,8 +31,8 @@ libraryDependencies ++= Seq(
   "ch.qos.logback" % "logback-classic" % "1.0.13",
   "ch.qos.logback" % "logback-classic" % "1.0.13",
   "org.codehaus.janino" % "janino" % "2.6.1",
   "org.codehaus.janino" % "janino" % "2.6.1",
   "com.lmax" % "disruptor" % "3.2.0",
   "com.lmax" % "disruptor" % "3.2.0",
-  "com.typesafe.akka" %% "akka-actor" % "2.2.1",
-  "com.typesafe.akka" %% "akka-slf4j" % "2.2.1",
+  "com.typesafe.akka" %% "akka-actor" % "2.2.3",
+  "com.typesafe.akka" %% "akka-slf4j" % "2.2.3",
   "org.apache.commons" % "commons-lang3" % "3.1",
   "org.apache.commons" % "commons-lang3" % "3.1",
   "org.apache.commons" % "commons-compress" % "1.5",
   "org.apache.commons" % "commons-compress" % "1.5",
   "commons-io" % "commons-io" % "2.4",
   "commons-io" % "commons-io" % "2.4",

BIN
plain/lib/plain-library_2.10-1.0.1-SNAPSHOT.jar


BIN
plain/sbt-launch.jar


+ 6 - 5
plain/setup.py

@@ -5,13 +5,13 @@ import time
 import os
 import os
 
 
 def start(args):
 def start(args):
-  setup_util.replace_text("plain/src/main/resources/application.conf", "127.0.0.1", args.database_host)
+  setup_util.replace_text("plain/src/main/resources/application.conf", "X127.0.0.1", args.database_host)
   if os.name == 'nt':
   if os.name == 'nt':
-    subprocess.check_call("./sbt.bat assembly", shell=True, cwd="plain")
+    subprocess.check_call(".\sbt.bat assembly && del /f /s /q target\scala-2.10\cache", shell=True, cwd="plain")
   else:
   else:
-    subprocess.check_call("./sbt assembly", shell=True, cwd="plain")
-     
-  subprocess.Popen("java -server -Xnoclassgc -XX:MaxPermSize=1g -XX:ReservedCodeCacheSize=384m -Xmx8g -Xss8m -Xmn4g -jar target/scala-2.10/plain-benchmark-assembly-1.0.1.jar", cwd="plain", shell=True)
+    subprocess.check_call("./sbt assembly && rm -rf target/scala-2.10/cache", shell=True, cwd="plain")
+
+  subprocess.Popen("java -server -da -dsa -Xrs -Xmx6g -Xmn4g -Xss8m -Xnoclassgc -XX:MaxPermSize=1g -XX:ReservedCodeCacheSize=384m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -jar target/scala-2.10/plain-benchmark-assembly-1.0.1.jar", cwd="plain", shell=True)
   time.sleep(10)
   time.sleep(10)
   return 0
   return 0
 
 
@@ -19,6 +19,7 @@ def stop():
   if os.name == 'nt':
   if os.name == 'nt':
     subprocess.call("taskkill /f /im *plain-benchmark* > NUL", shell=True)
     subprocess.call("taskkill /f /im *plain-benchmark* > NUL", shell=True)
     return 0
     return 0
+
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   out, err = p.communicate()
   for line in out.splitlines():
   for line in out.splitlines():

+ 5 - 4
plain/src/main/resources/application.conf

@@ -4,13 +4,14 @@
 
 
 akka {
 akka {
 	loggers = [ "akka.event.slf4j.Slf4jLogger" ]
 	loggers = [ "akka.event.slf4j.Slf4jLogger" ]
-	loglevel = OFF
-	stdout-loglevel = OFF
+	loglevel = off
+	stdout-loglevel = off
 }
 }
 
 
 plain {
 plain {
 	logging.level = INFO
 	logging.level = INFO
-	aio.send-receive-buffer-size = 1m
+	json.encode-output = off
+	http.ignore-accept-header = on
 	http.startup-servers = [ benchmark-server ]
 	http.startup-servers = [ benchmark-server ]
 	jdbc.startup-connection-factories = [ benchmark-mysql ]
 	jdbc.startup-connection-factories = [ benchmark-mysql ]
 }
 }
@@ -32,7 +33,7 @@ benchmark-mysql {
 	name = MysqlBenchmark
 	name = MysqlBenchmark
 	driver = mysql-5-6-12
 	driver = mysql-5-6-12
 	datasource-settings {	
 	datasource-settings {	
-		setUrl = "jdbc:mysql://127.0.0.1:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&dontTrackOpenResources=true&enableQueryTimeouts=false&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=1024&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=true&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true&poolPreparedStatements=true&maxOpenPreparedStatements=100"
+		setUrl = "jdbc:mysql://127.0.0.1:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=false&dontTrackOpenResources=true&enableQueryTimeouts=false&useLocalSessionState=false&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=1024&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=true&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true&poolPreparedStatements=true"
 		setUser = "benchmarkdbuser"
 		setUser = "benchmarkdbuser"
 		setPassword = "benchmarkdbpass"
 		setPassword = "benchmarkdbpass"
 	}	
 	}	

+ 7 - 5
plain/src/main/scala/com/ibm/techempower/Db.scala

@@ -6,6 +6,7 @@ import scala.language.implicitConversions
 import scala.language.postfixOps
 import scala.language.postfixOps
 import scala.collection.mutable.MutableList
 import scala.collection.mutable.MutableList
 
 
+import com.ibm.plain.ignore
 import com.ibm.plain.rest.{ Form, Resource }
 import com.ibm.plain.rest.{ Form, Resource }
 import com.ibm.plain.json.{ Json => J }
 import com.ibm.plain.json.{ Json => J }
 import com.ibm.plain.jdbc.withConnection
 import com.ibm.plain.jdbc.withConnection
@@ -37,7 +38,7 @@ sealed abstract class DbResource
     val output = new MutableList[J]
     val output = new MutableList[J]
     val q = form match { case None => 1 case Some(f) => queries(f) }
     val q = form match { case None => 1 case Some(f) => queries(f) }
     withConnection(datasource) { implicit connection =>
     withConnection(datasource) { implicit connection =>
-      for (i <- 1 to q) { for (j <- selectsql << next <<! asJson) { output += j } }
+      for (i <- 1 to q) { for (j <- selectsql << next ! asJson) { output += j } }
     }
     }
     form match { case None => output.head case _ => J(output.toList) }
     form match { case None => output.head case _ => J(output.toList) }
   }
   }
@@ -47,13 +48,14 @@ sealed abstract class DbResource
     val output = new MutableList[J]
     val output = new MutableList[J]
     val q = queries(form)
     val q = queries(form)
     withConnection(datasource) { implicit connection =>
     withConnection(datasource) { implicit connection =>
-      for (i <- 1 to q) { for (j <- selectsql << next <<! asTuple) { input += j } }
+      for (i <- 1 to q) { for (j <- selectsql << next ! asTuple) { input += j } }
       input.foreach {
       input.foreach {
         case (id, _) =>
         case (id, _) =>
           val randomNumber = next
           val randomNumber = next
-          updatesql << randomNumber << id <<!!;
+          updatesql << randomNumber << id ++;
           output += asJson(id, randomNumber)
           output += asJson(id, randomNumber)
       }
       }
+      ignore(updatesql ++!)
     }
     }
     J(output.toList)
     J(output.toList)
   }
   }
@@ -68,11 +70,11 @@ sealed abstract class DbResource
     case _: Throwable => 1
     case _: Throwable => 1
   }
   }
 
 
-  @inline private[this] final def asJson = (r: RichResultSet) => J(Map("id" -> r.nextNInt, "randomNumber" -> r.nextNInt))
+  @inline private[this] final def asJson = (r: RichResultSet) => J(Map("id" -> r.nextInt, "randomNumber" -> r.nextInt))
 
 
   @inline private[this] final def asJson(id: Int, randomNumber: Int) = J(Map("id" -> id, "randomNumber" -> randomNumber))
   @inline private[this] final def asJson(id: Int, randomNumber: Int) = J(Map("id" -> id, "randomNumber" -> randomNumber))
 
 
-  @inline private[this] final def asTuple = (r: RichResultSet) => (r.nextNInt, r.nextNInt)
+  @inline private[this] final def asTuple = (r: RichResultSet) => (r.nextInt, r.nextInt)
 
 
   @inline private[this] final def next = random.nextInt(1, 10001)
   @inline private[this] final def next = random.nextInt(1, 10001)
 
 

+ 2 - 2
plain/src/main/scala/com/ibm/techempower/Fortunes.scala

@@ -14,12 +14,12 @@ final class Fortunes
 
 
   Get {
   Get {
     val list = new ListBuffer[(Int, String)]
     val list = new ListBuffer[(Int, String)]
-    withConnection(datasource) { implicit c => for (row <- sql <<! asRow) { list += row } }
+    withConnection(datasource) { implicit c => for (row <- sql ! asRow) { list += row } }
     list += ((0, "Additional fortune added at request time."))
     list += ((0, "Additional fortune added at request time."))
     html(rows(list.sortBy(_._2))).toString
     html(rows(list.sortBy(_._2))).toString
   }
   }
 
 
-  @inline private[this] final def asRow = (r: RichResultSet) => (r.nextInt.get, r.nextString.get)
+  @inline private[this] final def asRow = (r: RichResultSet) => (r.nextInt, r.nextString)
 
 
   @inline private[this] final def rows(list: ListBuffer[(Int, String)]) = list.map { e => row(e._1, e._2) }
   @inline private[this] final def rows(list: ListBuffer[(Int, String)]) = list.map { e => row(e._1, e._2) }